Setting a variable value in Start() breaks tree variable mappings

Zurigan

New member
Unity 2019.3.0f6, BD 1.6.4

Ran into this spawning a bunch of monsters in Start(). If I set any variable in Start() i.e.

Code:
tree.SetVariableValue("LeaderTargetTransform", TargetTransform);

Then all the variable mappings seem to skip initialization to their mapped values and will return whatever their default type values are. No errors, warnings or other log messages are shown, this all just fails silently.

Delaying SetVariableValue in, for instance, a coroutine allows everything to work properly again.
 
For anybody following along this was fixed by first enabling the tree with tree.EnableBehavior(). The property mappings don't get initialized until after the tree is enabled. This is something that I plan on looking into seeing if the initialization order can be rearranged.
 
Top