Need Help with Behavior Designer Pro and write values to Tree

Old Rob

New member
Unity 6
6000.0.26f1
Behavior Designer Pro - DOTS Powered Behavior Trees
2.0.12 · June 28, 2025
and all updated DOTS Powered Behavior Trees AddOns

I made some BT for my Bot and testet them and some scripts for some days.
I made some Shared Scene Variables for my needs and was able to access them (Read/Write) via Mono Scripts too.
Suddenly I can't update my Variables in Tree anymore. Still I can read them out.
I was updating to newest version of BDPro and the Addons yesterday but I don't think that this will be the reason,
sure I did something I can't find for now. So I'm lost in space and need an advice.
What could be wrong if I can access the Scene Variables, read them out but can't write to them anymore?

//-------------------------------------------------------------------------------------------------------------------------------------
public string OurBotHealth; // => "BotMechHealth";

public enum VariablesScopes : byte
{
Self,
Empty,
Graph,
GameObject,
Scene,
Project,
Dynamic,
Subgraph
}

//-------------------------------------------------------------------------------------------------------------------------------------

void CheckOurHealth()
{
var sharedHealthVariable = (SharedVariable<int>)behaviorTree.GetVariable(OurBotHealth, (SharedVariable.SharingScope)variablesScopes);

if (sharedHealthVariable != null)
{
Health = sharedHealthVariable.Value; // this works, I can get the health from tree
Health = transform.GetComponent<EmeraldHealth>().Health; // this works too
sharedHealthVariable.Value = Health; // Both variants here do not work
behaviorTree.SetVariableValue(OurBotHealth, Health); //
}
}
 
public enum VariablesScopes : byte
{
Self,
Empty,
Graph,
GameObject,
Scene,
Project,
Dynamic,
Subgraph
}
You don't need to redefine the scope enum.

sharedHealthVariable.Value = Health; // Both variants here do not work
behaviorTree.SetVariableValue(OurBotHealth, Health); //
What doesn't work? I generally recommend using the Value property instead of SetVariableValue since setting the property is typesafe. You can see an example of setting the value within MeleeCombatSceneManager.Awake. This is from the sample projects that you have to import separately.
 
As written, I cant change the sharedHealthVariable.Value by script. // sharedHealthVariable.Value = Health;
This is definitely a problem inside the scene. I'm just able to access the Graph variables. GameObject and Scene not.
I was able to do that before what ever happend. It's not update releated for sure.
I made a new scene with one GameObject, Script and B- Tree and could access a test variable in Graph, GameObject and Scene
and change values by the script then. No problem at all.
But inside the BotTest scene there is a fault, as said above. I'm just able to change the Graph variables values.
I believe it is the best to delete all variables and build them up again in fact I can't see where to search this problem in the scene otherwise.
 
Back
Top