You can use the empty graph creation flow to create a new graph file and assign it to an existing GameObject in your project.
For more information on other ways to create a graph file, see Create a new graph file.
To create a new Script Graph and assign it to an existing GameObject:
[!includeopen-hierarchy-window]
In the Hierarchy window, select the GameObject where you want to assign the new graph.
[!includevisual-scripting-window]
Expand Create new Script Graph.
Select on selected game object.
Choose a location to save the new graph file.
Enter a name for the graph.
Select Save.
The new graph file automatically opens in a new window.
To create a new State Graph and assign it to an existing GameObject:
[!includeopen-hierarchy-window]
In the Hierarchy window, select the GameObject where you want to assign the new graph.
[!includevisual-scripting-window]
Expand Create new State Graph.
Select on selected game object.
Choose a location to save the new graph file.
Enter a name for the graph.
Select Save.
The new graph file automatically opens in a new window.
After you create a new graph, attach it to a Script Machine or State Machine to use it in your application. For more information, see Attach a graph file to a Script Machine or State Machine.