docs.unity3d.com
    Show / Hide Table of Contents

    Create and assign a graph to an existing GameObject

    You can use the empty graph creation flow to create a new graph file and assign it to an existing GameObject in your project.

    The Empty Graph Creation Flow window

    For more information on other ways to create a graph file, see Create a new graph file.

    Create a Script Graph

    To create a new Script Graph and assign it to an existing GameObject:

    1. Go to Window > General > Hierarchy, or press Ctrl+4 (macOS: Cmd+4) to open the Hierarchy window.

    2. In the Hierarchy window, select the GameObject where you want to assign the new graph.

    3. Go to Window > Visual Scripting > Visual Scripting Graph.

    4. Expand Create new Script Graph.

    5. Select on selected game object.

    6. Choose a location to save the new graph file.

    7. Enter a name for the graph.

    8. Select Save.

      The new graph file automatically opens in a new window.

    A new Script Graph, created with the empty graph creation flow with starter On Update and On Start Event nodes.

    Create a State Graph

    To create a new State Graph and assign it to an existing GameObject:

    1. Go to Window > General > Hierarchy, or press Ctrl+4 (macOS: Cmd+4) to open the Hierarchy window.

    2. In the Hierarchy window, select the GameObject where you want to assign the new graph.

    3. Go to Window > Visual Scripting > Visual Scripting Graph.

    4. Expand Create new State Graph.

    5. Select on selected game object.

    6. Choose a location to save the new graph file.

    7. Enter a name for the graph.

    8. Select Save.

      The new graph file automatically opens in a new window.

    Next steps

    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.

    In This Article
    • Create a Script Graph
    • Create a State Graph
    • Next steps
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023