Can not set value in Start function

TrungDong

Member
Hi, I followed this document:
https://opsive.com/support/document...es/accessing-variables-from-non-task-objects/
But myIntVariable was null. And when I tried to wait for 1 frame then set the variable, it is not null. (Use coroutine or set in Update()).
Is it a bug? Or Behavior Designer is designed to initialize all variables on Start(), so we have to wait for 1 frame to be able to access to those variables?
If it is not a bug, you should fix your document.
P/s: I used Behavior Tree Reference for my tree. Is it the cause?
 
Has your behavior tree deserialized at that point? It could be that the behavior tree has a different execution order compared to your script (which is why the 1 frame delay works).
 
Both have the default execution order (0), but after I set my script's execution order to +5, the problem has gone. Thank you very much.
 
Top