Reply To: Can access blackboard variables

NodeCanvas Forums Support Can access blackboard variables Reply To: Can access blackboard variables



There are 2 different blackboards you can access. One is the Blackboard component attached to the GraphOwner gameobject, and the other is the local Blackboard of the graph itself, the “Graph Blackboard”.

Both the ‘GraphOwner.blackboard’ and the ‘Task.blackboard’ properties (in actions and conditions) correspond to the gameobject Blackboard component that is assigned in the GraphOwner inspector (by default it is the same as the one attached to that gameobject). Please check if the blackboard parameter in the GraphOwner component inspector is assigned.

Only the ‘Graph.blackboard’ property corresponds to the graph’s local blackboard.

With that said, the easiest and more proper way to directly access your variables in either case (other than linking them to BBParameters fields in Tasks), is simply by using the GetVariableValue and SetVariableValue methods, like for example from within an Action Task:
blackboard.GetVariableValue<int>("myNumber"), or blackboard.SetVariableValue("myNumber", 12).
These methods will get/set the appropriate variable (matched by name and type) in either of the two Blackboards (gameobject Blackboard and graph Blackboard).

Please let me know if that works for you.
Thank you.

Join us on Discord: