Null Reference Exception for non-connected but linked node for the Owner property

vmuijrers

New member
I use an external behavior tree which contains a custom node which uses a list of Conditional nodes to which the node is linked (to do a filter on a list).
The conditional nodes are not actually part of the tree, I just want to use their OnUpdate functionality to do a check.
Unfortunately, during runtime once the OnUpdate is executed of one of these "linked-but-not-connected-nodes", there is no Owner (i.e. value returns "null") and therefore I cannot do checks against the variable dictionary within that node. (If I connect the node to the tree and disable it, the Owner member does return the correct GameObject). Not sure if this is a bug or by design, but I think a linked node should not necessarily be part of a tree to be used. (Using version 1.6.5 of Behavior Design and Unity 2019.2.4f1)
 
If the linked node isn't part of the tree it won't be initialized so that's why you are missing the references. This is by design because the detached nodes do not go through the setup process since they aren't used.

This is an interesting use case though - what is preventing you from just using the conditional task within the tree?
 
I see, thank you for the quick response! My goal is to grab a list of Enemies nearby and push the list through various checks and finally keep the best option and store it in a variable.
My approach was to let one node have a list of other conditionals and iterate through them, so that I don't have to make all the conditional nodes also work for lists. But maybe this is a silly approach and I should rewrite some of the conditional tasks to also accept lists?
 
Yes - I do think that the best course of action would be to allow it to accept lists.
 
Top