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.
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.