Reply To: Should behavior tree be part of a prefab?

Forums 💬 NodeCanvas 🗨️ General Discussion Should behavior tree be part of a prefab? Reply To: Should behavior tree be part of a prefab?

#14978
grofit
Participant

    I believe the is a known bug around subtrees and prefabs instantiation, I believe it is fixed in the newer version which is released soon, the fix I think is:

    In BTSubTree.cs, completely delete OnAwake which calls the CheckInstance within. Put that CheckInstance() call within OnGraphStarted later on at line #61 like so:

    public override void OnGraphStarted(){
    if (nestedTree){
    CheckInstance();
    foreach(Node node in nestedTree.allNodes)
    node.OnGraphStarted();
    }
    }

    I had the same issue where logic was fine, I moved to a prefab tree with subtrees and it blew up, but the author was super fast to assist and fix.