Behavior Tree stops running when unloading a unity scene.

finanon123

New member
The problem I have is this: I have a basic main menu from which you can begin the game by pressing a button. Once new game button is pressed I load the first level containing the enemies (with BD) and all is fine. However upon completion of the first level loading I also unload the menu scene, this is where the tree stops working.

When the menu scene is unloaded (holds no references to BD or enemies in the level scene) the BD tree on every enemy just stops. The nodes in the editor are grey (NOTE: not greyed out as if they aren't reachable, but the usual color as they are while editing etc). But the nodes that were running before the tree stopped still have the green tick icons. It's definitely the menu scene unloading that causes this as when I disable the unloading menu scene they work perfectly.

Any ideas as to why this would be happening? Thanks in advance.

Edit: also the method of unload the scene is unloadSceneAsync()
 
It sounds like the Behavior Manager is also being unloaded. It gets instantiated at runtime but you can also bring it in ahead of time and mark it as DontDestroyOnLoad.
 
Yep that was it, behavior manager was getting instantiated inside the Menu scene. Don't know why I didn't think to check that! Thanks a bunch!
 
Top