Choose a variable scope according to who needs the value. Keep a value in the graph when it belongs to one state machine, or use a broader scope when multiple state machines must read and change the same value.
Choose a scope in the editor
The Shared Variables pane has four tabs for variables that are created ahead of time: Graph, GameObject, Scene, and Project. Select the tab before adding or editing a variable.

Dynamic variables are selected from an individual Shared Variable field instead of from a tab.
Which scope should you use?
| Scope | Use it when | Available to | Storage |
|---|---|---|---|
| Graph | The value belongs to one graph. This is the usual starting point. | Nodes in the attached graph. | The graph’s Shared Variables. |
| GameObject | Multiple state machines on the same GameObject need one value. | State machines attached to that GameObject. | A GameObjectSharedVariables component on the GameObject. |
| Scene | State machines on different GameObjects in one scene need one value. | State machines in the running scene. | A SceneSharedVariables component in the scene. |
| Project | State machines in different scenes need a project-wide value. | State machines throughout the project. | The ProjectSharedVariables ScriptableObject in a Resources folder. |
| Dynamic | A small number of fields in one running graph need a temporary shared value without adding it to the Shared Variables pane. | Fields in the attached graph that use the same Dynamic name. | Created for the graph at runtime. |
By default, State Designer creates the Project asset at Assets/Opsive/GraphDesigner/Resources/ProjectSharedVariables.asset. You can move it, but it must remain inside a Resources folder so it can be loaded at runtime.
Create a Dynamic variable
In the Element Inspector, select the circle beside a compatible Shared Variable field and choose (Dynamic).

Enter the shared name in the Name field that appears.

Use the exact same name and variable type in every field that should share the Dynamic value. Names are case-sensitive, and a Dynamic name must not match an existing Graph variable name.
How it runs
A Graph variable is resolved from the attached graph. A GameObject variable is resolved from the GameObjectSharedVariables component on the state machine’s GameObject. Scene and Project variables are resolved from their respective shared containers.
Dynamic fields with the same case-sensitive name and type are mapped to the same runtime variable within the attached graph. They do not appear as a fifth tab because they are created from the fields that use them.
Verify the scope
Reference the same variable from two compatible fields, enter Play Mode, and change the value through one of them. Confirm that the other field reads the same value.
For a broader scope, repeat the check from two state machines on the intended GameObject or in the intended scene. For a Dynamic variable, confirm that both fields use the same spelling and type. State Designer reports an error if Dynamic variables with the same name use different types or if a Dynamic name conflicts with a Graph variable.