Closed ricardojmendez closed 12 years ago
This issue persists on 1.4
No repro seen since latest 1.4 fixes. Closing as fixed.
I've just found this issue on 1.4. I'm logging both InitMove and TickMove actions on a tree.
Domo-DomoSpawner-0 InitMove 1.844796 UnityEngine.Debug:Log(Object) VehicleCreature:InitMoveItAction(Tree) (at Assets/PapercraftCode/Agents/Base/VehicleCreature.cs:106) BTCreaturesC1T0:TickAgent(IAgent, Int32, Boolean, Tree, String, Single, Object)
Domo-DomoSpawner-0 Move 1.844796 Running UnityEngine.Debug:Log(Object) VehicleCreature:TickMoveItAction(Tree) (at Assets/PapercraftCode/Agents/Base/VehicleCreature.cs:118) BTCreaturesC1T0:TickAgent(IAgent, Int32, Boolean, Tree, String, Single, Object)
Domo-DomoSpawner-0 Move 1.880821 Running UnityEngine.Debug:Log(Object) VehicleCreature:TickMoveItAction(Tree) (at Assets/PapercraftCode/Agents/Base/VehicleCreature.cs:118) BTCreaturesC1T0:TickAgent(IAgent, Int32, Boolean, Tree, String, Single, Object)
[...]
Domo-DomoSpawner-0 Move 3.521052 Running UnityEngine.Debug:Log(Object) VehicleCreature:TickMoveItAction(Tree) (at Assets/PapercraftCode/Agents/Base/VehicleCreature.cs:118) BTCreaturesC1T0:TickAgent(IAgent, Int32, Boolean, Tree, String, Single, Object)
Then the tree gets reset. Some time later it ends up on the Move action again, and the next one logged is:
Domo-DomoSpawner-0 Move 10.66101 Running UnityEngine.Debug:Log(Object) VehicleCreature:TickMoveItAction(Tree) (at Assets/PapercraftCode/Agents/Base/VehicleCreature.cs:118) BTCreaturesC1T0:TickAgent(IAgent, Int32, Boolean, Tree, String, Single, Object)
With no InitMove action being logged.
Found it - this happens if Reset is called from within a running action handler.
Finally stomped on this nasty bugger. The Running return value was key. 1.5 holds a fix addressing this directly.
I have a behavior tree on Behave 1.3.1 where Behave might be called in the middle of a Move action (since it might be interrupted by the agent being attacked).
Suppose the creature gets stunned while moving, which invokes a behaviorTree.Reset(). It will eventually reach the Move action dagain. However, the time that Move is ticked after the Reset() the InitMoveAction is not called as it should, so it skips any initialization that you meant to do.