GetAllVariables GC Allocation

Culzean

New member
We have a setup using 2 behaviour tree components with different group indices on the same enemy.
In this way tree 0 can run a new external tree that is set as the external tree for the tree in group 1. This new external tree is then executed.

We have set it up so that they share their blackboards. To share the variables we're using GetAllVariables on the Behaviors and running some code to migrate required variables into the second Behaviour Tree.

Profiling this code I noticed that every time GetAllVariables is called there is a GCAlloc is created from this.CheckForSerialization();.

Is their a safe non-alloc way to run something like this? Does the tree need to check for serialization every time GetAllVariables is called?
 
It does check for serialization because the behavior tree may not be serialized before that method is run. CheckForSerialization doesn't do any actual allocation though unless it needs to deserialize. On the downloads page you can download the runtime source if you'd like to step through to determine why it thinks that it needs to serialize.
 
Top