Should behavior tree be part of a prefab?

NodeCanvas Forums General Discussion Should behavior tree be part of a prefab?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #9263

    I have a character prefab that uses behavior tree that is outside of the prefab. The first character that is instantiated acts normal like it should. If I create more they start acting weird. If I have just one instance of a behavior tree that every character is referencing, does each of the characters uses it’s own copy with own variables, or are they shared? In that case I should probably look into some mistakes I have inside that tree.

    #9265

    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.

    #9264
    Gavalakis
    Keymaster

    Yep,
    That’s definetely the reason. Thanks grofit 🙂

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

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