Qriva / MonoBehaviourTree

Simple event driven Behaviour tree for Unity projects
MIT License
261 stars 19 forks source link

Get rid of garbage generation when execution stack state is stored by node #1

Closed Qriva closed 3 years ago

Qriva commented 3 years ago

Method GetStack() creates new array every time it's called. Array should be pre-allocated and filled with elements instead. StoreBTState can be renamed to something like GetTreeSnapshot or ObtainTreeSnapshot.

https://github.com/Qriva/MonoBehaviourTree/blob/76dce2d5afbcf354626432c05ef3a1ae23f3d35f/Assets/MonoBehaviourTree/Source/Runtime/Nodes/Decorator.cs#L56