docs.unity3d.com
    Show / Hide Table of Contents

    Creating a custom event unit

    A custom event unit can trigger your own events across graphs, along with custom arguments. To trigger the custom event from elsewhere, you need to use a Trigger Custom Event unit.

    To create a custom event

    In a script graph:

    1. Right-click on an empty spot.
      The fuzzy finder appears.
    2. Select Events > Custom Event.
      Unity places a Custom Event unit in the graph.
      Note: The first argument is indexed Arg 0. The arguments are the values the event can process. If you want extra data ports, increase the Arguments field to the number of data ports (for example four data ports means Arguments = 4).

    Note: The sender and receiver units must have the same number of arguments.

    To trigger a custom event

    In a script graph:

    1. Right-click on an empty spot.
      The fuzzy finder opens.

    2. Select Events > Custom Event > Trigger Custom Event.
      Note: The name of the event must be the same as the Custom Event (the label is case- and space-sensitive).
      The GameObject containing the script machine with the event you want to trigger must be connected to the GameObject’s data port.
      Unity places a Trigger Custom Event unit in the graph.
      The first argument is indexed Arg 0. The arguments are the values that the event can process. If you want extra data ports, increase the Arguments field to the number of data ports (for example four data ports means Arguments = 4).

    Note: The sender and receiver units must have the same number of arguments. Alsol, when you trigger the event, there need to be values associated with the arguments, even if the values are not used. All arguments through data ports need to be connected to another unit or you receive error messages.

    Back to top
    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