This time, we will introduce how to use Custom Event in Visual Scripting.
What is Custom Event?
In Unity’s Visual Scripting, a Custom Event is a mechanism that allows you to define and call custom events at any time. It is useful for communication between scripts and triggering specific processes.
This time, we will create a system where pressing a button changes the color of an object.

We will create a Script Graph with this structure.

The completed project can be downloaded from the following:
Preparation
Place the following objects in the scene:
- Cube (the object whose color will change)
- Button × 2 (buttons labeled “Red” and “Blue”)
Arrange the objects appropriately (refer to the sample layout).
Creating ChangeColorReceiver
1. Add a “Script Machine” component to the Cube.
2. Create a new Script Graph and name it ChangeColorReceiver.
3. Create String-type variables named “Change Red” and “Change Blue”.

Add the following nodes:
- Custom Event: Set an event name and configure it to receive a String-type argument.
- Get Material: Retrieve the Cube’s material.
- Change Color: Change the material color based on the received argument.

Creating ChangeBlueGraph and ChangeRedGraph
1. Add a “Script Machine” component to each button.
2. Create the following Script Graphs for each button:
- For Red: ChangeRedGraph
- For Blue: ChangeBlueGraph
3. Create a GameObject-type variable named “ChangeColorCube” and assign the Cube to it.


Add the following nodes:
On Button Click: Starts the process when the button is clicked.
Call Custom Event: Input the String-type variable names “ChangeRed” and “ChangeBlue” from the ChangeColorReceiver creation step into the CustomEvent node (make sure to enter the spelling correctly).


Execution

Pressing the buttons will change the Cube’s color to either “red” or “blue”.
Conclusion
Custom Events are a useful mechanism in Visual Scripting that enable flexible communication between scripts. By leveraging this system, you can build simple and manageable event-driven systems.