Pausing and resuming Behavior Tree

Hi there!

TL;DR: Is there any way to completely pause a behavior tree’s execution and later resume it at the exact same spot / node where it was?

Long explanation:
I’ve built my NPC’s AI through behavior trees. They move, animate and perform different tasks. I need them to pause when the player opens certain menus, and then resume the execution at the exact same spot, as if nothing had happened, when the menu closes.

I can’t just pause the whole game because I’m using timers to drag and drop widgets, and spawning actors while these menus are open. I’ve tried setting Tick Even when Paused to true in the actor that creates the widgets, to no use.

I have also tried setting the Custom Time Dilation to 0 for the NPCs and they do pause, but if the behavior tree is running a Move To node, it fails after a few seconds and the sequence or the branch restarts.

Any suggestions on how to solve this? Am I approaching it the wrong way? I’m using blueprints, but I’m open to a C++ solution at this point :smiling_face_with_tear:

Thank you!!

2 Likes