Reply To: Best practice for similar method as class vars and instance vars?

FlowCanvas Forums Support Best practice for similar method as class vars and instance vars? Reply To: Best practice for similar method as class vars and instance vars?

#2570
elvisish
Participant

Hello there, Once in playmode, all agents (FlowScriptController) create an instance of the graph being used. As such, in playmode, each graph has it’s own instance of blackboard variables as well and thus changing the variable value in one of the instanced prefabs of your character will naturally not change the variable value on all other instances but rather only to that instance. So regarding testing and finding the correct speed value in your example, it can only be done so in one instance at a time in playmode and as soon as the correct value is found and exit playmode, the change the characters prefab speed variable to that desired speed value. The next time you enter playmode and an instance of that prefab is made, all instances will share the same speed variable value initially.

Thanks, yes all agent create an instance of the graph being used, so technically the same as if I had a C# script with defaults (or a bolt 2 class with defaults), changing the instance var would only affect that instance. The slight difference to graph variables is that c# script vars have defaults and overrides on each instance, which I guess matches with how object blackboard vars work? I’m trying to figure out which method would be as similar to a c# script with default vars and instance overrides, using graph vars, object vars or object vars with prefab for setting all of the defaults?