Qriva / MonoBehaviourTree

Simple event driven Behaviour tree for Unity projects
MIT License
261 stars 19 forks source link

Error OnExit with custom Leaf #5

Closed Variapolis closed 2 years ago

Variapolis commented 2 years ago

Hi,

I get the following error seemingly when I try to abort "Both" on a custom leaf (edit: Tried it with non-custom leafs and it still occurs). Happens regardless of if the state is "Running" or "Success" but if the state ends in success, the error is more consistent.

Parameter name: index
System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <695d1cc93cca45069c528c15c9fdd749>:0)
MBT.MonoBehaviourTree.EvaluateInterruptions () (at Assets/MonoBehaviourTree/Source/Runtime/MonoBehaviourTree.cs:98)
MBT.MonoBehaviourTree.Tick () (at Assets/MonoBehaviourTree/Source/Runtime/MonoBehaviourTree.cs:119)
MBT.MBTExecutor.Update () (at Assets/MonoBehaviourTree/Source/Runtime/MBTExecutor.cs:21)

Any idea what might be causing it?

Qriva commented 2 years ago

Hello, that one is interesting. For some reason aborting node is not on the execution log or maybe node index is not valid, but in any case this should not happen. Can you try provide more detailed reproduction steps?

Variapolis commented 2 years ago

Found the issue, I hadn't set up OnAllowInterrupt and OnDisallowInterrupt properly in my condition. I'm using UniRx + Zenject instead of a blackboard and thus my stream was trying to abort even when it shouldn't have been.

Thanks for the timely response, and sorry for wasting your time. I'm closing this now as the issue was pebcak and invalid :)