jkaczmar
Member
I recently pulled a Behavior Tree tied to an NPC directly out into a Subtree. As soon as I do that, it loses its ability to use CanDetectObject. I'm using a Target variable that I populate with Player which I can confirm does show up in the inspector in both cases during runtime. However, the CanDetectObject always fails when the tree is referenced as a subtree and always works when the tree is tied directly to the NPC. Likewise, Seek can't track the Player even though Target is populated with the Player prefab.
Other code that relies on that Target variable = Player seem to work. For example, UCC isAlive checks on Target = Player and passes as expected.
The fact that the correct value shows up in both the Unity inspector as well as the variable section in the Subtree when I watch it during runtime would seem to indicate that I've set things up right. However, perhaps there is a nuance for setting up variables during runtime that I am missing? I've read through all the documentation and the samples already to no avail.
Also, is there a way to move subtree code back into the NPC once I've moved it out?
Other code that relies on that Target variable = Player seem to work. For example, UCC isAlive checks on Target = Player and passes as expected.
The fact that the correct value shows up in both the Unity inspector as well as the variable section in the Subtree when I watch it during runtime would seem to indicate that I've set things up right. However, perhaps there is a nuance for setting up variables during runtime that I am missing? I've read through all the documentation and the samples already to no avail.
Also, is there a way to move subtree code back into the NPC once I've moved it out?