Hello Justin, I hope this message finds you well. Please see below for a description of a possible issue with the intended functionality of trees when activating/deactivate their gameobject.
Any advice or insight? Thanks in advance!
Wes
Behavior Tree starts by it self when resuming even though StartWhenEnable is set to false and the Tree is clearly not running.
Steps:
1. In an empty Scene, create two gameobjects BT_A and BT_B. Add A behavior tree to both BT_A and BT_B.
2. Set PauseWhenDisable=true via the Unity Inspector for BT_A and BT_B
3. Set StartWhenEnabled=false for BT_B
5. Add Idle node to BT_A and BT_B
7. Press play to run the simulation
8. Select BT_B from the Unity Editor Hierarchy and disable the GameObject via the unity inspector by checking the active/deactive check box.
9. Reenable the BT_B Gameobject by checking the checkbox to active in the active/deactivate check box of the inspector.
Observed:
Notice that BT_B has now run even though the behavior tree was not started prior to the deactivate of the MyTestNPC gameobject.
The issue only seems to manifest when there are more that one Behavior Trees in the scene. Delete BT_A and re-run the project. In this case you will see that the BT_B is not run when the gameobject is re-activated.
Expected:
The Behavior Tree should not be Started when it's gameobject becomes activated following a deactivation where Behavior Tree was not yet started.
I've attached a video to illustrate the issue here (sorry for the poor audio quality). if the repo steps are not clear, please let me know and i will re-record a video:
Any advice or insight? Thanks in advance!
Wes
Behavior Tree starts by it self when resuming even though StartWhenEnable is set to false and the Tree is clearly not running.
Steps:
1. In an empty Scene, create two gameobjects BT_A and BT_B. Add A behavior tree to both BT_A and BT_B.
2. Set PauseWhenDisable=true via the Unity Inspector for BT_A and BT_B
3. Set StartWhenEnabled=false for BT_B
5. Add Idle node to BT_A and BT_B
7. Press play to run the simulation
8. Select BT_B from the Unity Editor Hierarchy and disable the GameObject via the unity inspector by checking the active/deactive check box.
9. Reenable the BT_B Gameobject by checking the checkbox to active in the active/deactivate check box of the inspector.
Observed:
Notice that BT_B has now run even though the behavior tree was not started prior to the deactivate of the MyTestNPC gameobject.
The issue only seems to manifest when there are more that one Behavior Trees in the scene. Delete BT_A and re-run the project. In this case you will see that the BT_B is not run when the gameobject is re-activated.
Expected:
The Behavior Tree should not be Started when it's gameobject becomes activated following a deactivation where Behavior Tree was not yet started.
I've attached a video to illustrate the issue here (sorry for the poor audio quality). if the repo steps are not clear, please let me know and i will re-record a video: