Abort part of the tree


New member

I was seeing a NullRefs in my Behavior Trees because of a conditional abort that triggered too late. I've made a small reproduction of this. The tree kinda looks like this, but then way more complicated:


The Shoot Target has a chance to kill the target, which should make IsTargetAlive return a failure. For this test, pretend that ShootTarget will immediately kill the target. I don't want MoveToTarget to still happen, because there is no target anymore. Unfortunately, MoveToTarget is still called, as you can see in this image.

Is there a way to completely abort the whole left part of the selector until another target is set? I've tried it with interrupt, but I don't understand what it does. This is my attempt:


PerformInterruption is called, but MoveToTarget is still called as well. Also, the whole tree just stops. I would expect it to continue on the right side, but nothing happens. I don't get it why this stops the whole tree, even though I have a Repeater set to repeat forever.

Can someone help me out? Thanks in advance.


Staff member
Perform Interruption is what you want. Try deselecting "Instant" on the Perform Interruption task so it'll wait a tick before moving to the next task.


New member
Disabling "Instant" worked, but I'm not really sure why though. I didn't even knew about this "Instant". The only problem I had, was that IsTargetAlive was never checked again while in the idle state on the right.

Now that I know of "Instant", I've decided to solve this differently. I've used my first tree, and disabled "Instant" on ShootTarget, so the conditional abort can check again next frame. I don't need the interruption then.

Thanks for the help!