How to restart a behavior tree ?!

NodeCanvas Forums Support How to restart a behavior tree ?!

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #12203
    vudong
    Participant

    As topic title. I have a gameobject and I want to restart behavior tree after behavior tree done.

    #12216
    Gavalakis
    Keymaster

    Hello,

    You can simply call “StartBehaviour()” on the BehaviourTreeOwner to restart the owner’s assigned BehaviourTree.
    Also, if the “repeat” property is checked in the BehaviourTreeOwner inspector, the behaviour will always automatically repeat without having to manually restart it, if that is what you are after by any chance.

    Let me know if that works for you.
    Thanks.

    Join us on Discord: https://discord.gg/97q2Rjh

    #12245
    arachnidjacob
    Participant

    Can you call StartBehaviour on a subtree node to reset? I noticed that swapping out BT’s in a subtree’s BT slot does not restart, but rather resumes execution from where it last was working.

    #12249
    Gavalakis
    Keymaster

    Hello,

    StartBehaviour can’t be called on SubTrees, no, but SubTrees should reset when the SubTree NODE (that has the reference to the actual SubTree asset) is reset, which is usually done just after an evaluation cycle/tick of the parent tree.
    Are you by any chance, swap the target SubTree by using a blackboard variable or manually, and doing so *while* the subtree is already running?

    Thanks.

    Join us on Discord: https://discord.gg/97q2Rjh

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.