Avoid gloabal sharing of dynamic variables in subtrees

Schreppy

New member
Hello, I have a question regarding dynamic variables. I have a subtree attached to various NPCs. I have now noticed that these dynamic variables are shared across all NPCs. How can I prevent this? I want the dynamic variables to be used locally per NPC and not globally.
 
When a subtree is injected it will add all of the variables contained within that subtree. It's not possible to not inject those variables for each subtree. The variables that are injected are local to the current Behavior Tree component and are not shared - I just created a small test scene to verify and this was the case.
 
I'm having the same issue. Dynamic variables are being shared among all NPCs. I tested this with an integer that increments every time my custom conditional updates. As you can see in my screenshot, the numbers starting with 429496729x are the UUIDs of my NPCs. I have 3 NPCs, and the incremental number goes from 1 to 3 across the updates from each NPC. It's also a bit odd that some numbers are missing; for example, I didn't get 429496729x - AttackTurretConditional, 4, ... 5, and ... 12."

I'm using Unity version 6000.2.6f2. I was on Behavior Designer Pro 2.1.9 and just updated to 2.1.10, but the issue persists.

1766736583011.png
 
Last edited:
Here's the test scene that I used earlier. Can you modify it to show the issue? In this test scene there are three different behavior trees and the same value is outputted three times each tick. Alternatively, you can send a repro scene to support@opsive.com and I can take a look.
 

Attachments

I downloaded your unitypackage and tried a few different setups to match my settings as closely as possible, but I can't repro the issue in the test scene. Weirdly enough, after testing back and forth between my scene and the test scene (both running in the same Unity project) it suddenly started working as intended for my NPCs as well. I'm still confused as to why the incremental number '2' didn't show up in the logs, though (`429496729x - AttackTurretConditional, 2`).
1766977943697.png
 
Back
Top