4.9 KiB
Create a transition between states
To switch between states in a State Graph, you must use a Script Graph called a transition.
For more information on State Graphs, see State Graphs.
Create a transition with an embedded Script Graph
To create a new transition to another state with an embedded graph in a State Graph:
- With a State Graph open in the Graph window, do one of the following:
-
Right-click on the state where you want to make a transition, then in the context menu, select Make Transition.
-
Select the state where you want to make a transition, then press Ctrl+click and drag away from your selected state.
- Do one of the following:
-
Select or release while on an existing state in your State Graph to connect the states with a transition.
-
Select or release while on an empty space in the Graph Editor to automatically create a new blank Script State at the end of your transition.
-
Select your transition node.
-
Open the Graph Inspector.
-
In the Graph Inspector, set the Source to Embed.
-
In the (Title) field, enter a title for your transition's Script Graph.
-
In the (Summary) field, enter a brief descriptive summary of your transition's Script Graph.
[!NOTE] If you choose to use an embedded transition Script Graph, Visual Scripting automatically provides the Trigger Transition node you need for the graph.
Create a transition with an external Script Graph file
To create a new transition with a graph asset file in a State Graph:
- With a State Graph open in the Graph window, do one of the following:
-
Right-click on the state where you want to make a transition, then in the context menu, select Make Transition.
-
Select the state where you want to make a transition, then press Ctrl+click and drag away from your selected state.
- Do one of the following:
-
Select or release while on an existing state in your State Graph to connect the states with a transition.
-
Select or release while on an empty space in the Graph Editor to automatically create a new blank Script State at the end of your transition.
-
Select your transition node.
-
Open the Graph Inspector.
-
In the Graph Inspector, set the Source to Graph.
-
Do one of the following:
-
Select the object picker (circle icon). Select a Script Graph from your project.
-
Click and drag a Script Graph file from your Project window and release on the Graph field.
-
Select New and create a new Script Graph.
-
-
Double-click the new transition node to open the transition Script Graph.
Create a self transition with an embedded Script Graph
To create a new self transition for a state in a State Graph:
-
With a State Graph open in the Graph window, right-click on the state where you want to make the transition.
-
In the context menu, select Make Self Transition. Visual Scripting attaches a new Self Transition node to the state in the State Graph automatically.
-
Select your transition node.
-
Open the Graph Inspector.
-
In the Graph Inspector, set the Source to Embed.
-
In the (Title) field, enter a title for your transition's Script Graph.
-
In the (Summary) field, enter a brief descriptive summary of your transition's Script Graph.
-
Double-click the new self transition to open the transition Script Graph.
[!NOTE] If you choose to use an embedded transition Script Graph, Visual Scripting automatically provides the Trigger Transition node you need for your graph.
Create a transition with an external Script Graph file
To create a new transition with a graph asset file in a State Graph:
-
With a State Graph open in the Graph window, right-click on the state where you want to make the transition.
-
In the context menu, select Make Self Transition. Visual Scripting attaches a new Self Transition node to the state in the State Graph automatically.
-
Open the Graph Inspector.
-
In the Graph Inspector, set the Source to Graph.
-
Do one of the following:
-
Select the object picker (circle icon). Select a Script Graph from your project.
-
Click and drag a Script Graph file from your Project window and release on the Graph field.
-
Select New and create a new Script Graph.
-
-
Double-click the new transition node to open the transition Script Graph.