docs.unity3d.com
  • Manual
  • Scripting API
  • Changelog
  • License
Show / Hide Table of Contents
  • About Visual Scripting
    • Configure project settings
      • Add or remove available nodes
      • Add or remove types
      • Create or restore a backup
    • Choose a control scheme
    • Configure your preferences
    • Update Visual Scripting
    • Version control systems
    • Use Visual Scripting with Unity Cloud Build
  • Basic concepts in Visual Scripting
    • The interface
    • Nodes
    • Graphs
      • Subgraphs and State Units
      • Transitions
    • Script Machines and State Machines
    • Object types
      • Custom types
    • Variables
  • Develop application logic with Script Graphs
    • Create a new graph file
      • Create a new blank graph with the Project window
      • Create a new unassigned graph with the empty graph creation flow
      • Create and assign a graph to an existing GameObject
      • Create and assign a graph to a new GameObject
      • Create a graph on a Script Machine or State Machine
    • Attach a graph file to a Script Machine or State Machine
    • Open a graph file
      • Add a node to a Script Graph
      • Connect nodes in a Script Graph
      • Create and add a variable to a Script Graph
      • Create node groups
      • Add comments to a graph
    • Add a Subgraph to a Script Graph
      • Add a Trigger or Data port to a Script Graph
    • Add a State Unit to a Script Graph
    • Custom Events
      • Add a Custom Event node
      • Add a Trigger Custom Event node
    • Capture user input in an application
      • Capture input using the Input Manager
      • Add and configure a Player Input component
      • Capture input using the Input System package
    • Use relations to debug
      • Predictive and live debugging
      • Working with debug messages
    • Live edit
      • Live edit during runtime
  • Develop logic transitions with state graphs
    • Create a new state
    • Create a transition between states
  • Advanced customization and development
    • Refactor a C# script with Visual Scripting
      • Add the RenamedFrom attribute to a C# script
    • Custom C# nodes
      • Create a new simple Custom C# node
      • Add ports to your Custom C# node
      • Add logic to your Custom C# node
      • Add relations to your Custom C# node
      • Add documentation to your Custom C# node
      • Custom C# node attributes reference
    • Create a Custom Scripting Event node
      • Create a Custom Scripting Event Sender node
      • Trigger a Custom Scripting Event from a C# script
      • Listen to a Custom Scripting Event from a C# script
    • Use a custom type
      • Add the Inspectable attribute to a custom type
      • Create a custom PropertyDrawer for a custom type
  • Node reference
    • This node
    • Control node
    • Time node
    • Events
      • Event nodes
      • Input Event nodes
        • On Input System Event Button
        • On Input System Event Float
        • On Input System Event Vector 2
        • On Button Input
        • On Keyboard Input
        • On Mouse Down
        • On Mouse Drag
        • On Mouse Enter
        • On Mouse Exit
        • On Mouse Input
        • On Mouse Over
        • On Mouse Up As Button
        • On Mouse Up
    • Variable node
    • Nulls node
    • Formula node
    • Nesting
      • Input node
      • Output node
      • State Unit node
      • Subgraph node
    • Script graph nodes
    • State graph nodes
  • Developer's guide
  • Known Issues

Add a Custom Event node

You can add a Custom Event node to a Script Graph to trigger specific logic after an Event occurs. For more information about custom Events, see Custom Events.

Note

To use a Custom Event node, you must configure the node with the following instructions, then add a Custom Event Trigger node to your graph. For more information on how to add a Custom Event Trigger node, see Add a Custom Event Trigger node

To add a Custom Event node to a Script Graph:

  1. Open the Script Graph where you want to add a Custom Event node.

  2. Right-click anywhere in the Graph Editor to open the fuzzy finder..

  3. Go to Events.

  4. Select the Custom Event node to add it to your graph.

  5. In the GameObject field, indicated by the GameObject icon on the node, choose the GameObject where you want to create the Event. Do one of the following:

    • Select the object picker (circle icon), and select a GameObject.
    • Attach a node to the field's data input port that outputs a GameObject.
    • Leave the field as the default value of This to use the GameObject where you attached your Script Graph to a Script Machine.
  6. In the Arguments field, enter the number of arguments you want the custom Event to receive and pass to other nodes in your graph. The default value is 0. If you enter a number greater than 0, Visual Scripting adds the corresponding number of Output ports to the Custom Event node.

    Note

    Visual Scripting labels your first argument as Arg. 0.

  7. Enter a unique name for the custom Event through one of the following methods:

    • Enter a name in the field next to the Name input port.
    • Attach a node that outputs a string value to the Name input port.

In the following example, a custom Event called On Damage returns a single argument when it's triggered in a Script Graph.

An image of the Graph window, that displays a Custom Event node. Its Arguments are set to 1, its Target is set to This, and its Name is set to On Damage.

Next steps

After you add a Custom Event node to your graph, add more nodes to your graph or connect nodes to specify what happens after your Event triggers.

Then, add a Custom Event Trigger node to specify when to trigger the custom Event in your graph.

To create more complex logic for your custom Event, you can also create a Custom Scripting Event node.

In This Article
Back to top
Copyright © 2025 Unity Technologies — Trademarks and terms of use
  • Legal
  • Privacy Policy
  • Cookie Policy
  • Do Not Sell or Share My Personal Information