BehaviorTree in multi-scene breaks

Someone

New member
Does the BehaviorTree runtime link itself to a specific scene? I am experiencing a weird bug.
  1. Load Scene A additively
  2. Spawn BehaviorTree in Scene A
  3. BehaviorTree works fine
  4. Load Scene B additively
  5. SceneManager.MoveGameObjectToScene(gObj, sceneB)
  6. Unload Scene A
  7. BehaviorTree just... stops updating. No errors, no warnings, no task events are called. Nothing.

    If so, is there a workaround?
 
Found the problem.
I have to explicitly create an instance of BehaviorManager and not let it be auto-created, and then ensure it doesn't get destroyed.

It seemed to get auto-created in scene A.
So, when scene A got unloaded, the BehaviorManager got unloaded, too.
 
Top