External variables for BT Reference not working in lists

wrymen

New member
There is a nasty bug with setting variables via Behavior Tree Reference node

I have a Behavior Tree asset, with "Attack Target" variable of type Entity (Monobehavior)
upload_2022-12-20_22-0-34.png

This tree has a node, Clear Targets, focus on two variables, List<SharedEntity> and SharedEntity
upload_2022-12-20_21-58-39.png

They point to the above declared "Attack Target" variable.

Now I have another Behavior Tree, which has a Behavior Tree Reference node reference to the above tree. There is "Nearby Target" variable of type Entity.
I linked it, so the first tree variable is replaced by this Nearby Enemy.
upload_2022-12-20_21-59-10.png


Now all works fine, except the List<SharedEntity> is not replaced correctly, but the SharedEntity variable is replaced:
upload_2022-12-20_22-5-49.png

You can see the "Targets" variable list has the original "Attack Target" variables linked, which should not even exist. The "Target" variable has the correct "Nearby Enemy" linked.
 
I think that I was able to reproduce this, but if you can verify my repro scene that would be great. In this scene you'd expect the Target1 value to be replaced by the MyTarget value, correct? That looks like it should be the correct workflow and I'll let you know after I am able to fix it.
 

Attachments

  • Repro.unitypackage
    3.6 KB · Views: 1
@Justin not sure I understand your reproduction package. It does not have two behavior tree assets, nor it does have variable that is a List of some references.

To reproduce, it should have behavior tree A and behavior tree B.
- A should have variable declared (e.g. GameObject)
- A should create external behavior tree node and reference behavior tree B
- B should have variable declared (e.g. GameObject)
- in B, create a custom node class, that will have List of SharedGameObjects
- link this shared variable to the declared List variable (at least one element)
- A should change this variable in the external behavior tree node
 
I believe that's what the repro package simulates in a simplified way. In this case since you are overriding the variables with the external tree the problem comes from the override and not a second behavior tree component. I'll get this fixed and lets see if the problem still exists with your setup.
 
Top