EventTrigger
The EventTrigger receives events from the Unity EventSystem and calls the registered functions.
To use the Unity EventTrigger in ZEPETOScript, you must follow the format given below.
First, for testing purposes, add UI > Panel to the Scene.
Click [Add Component] in the inspector of the added Panel, and add the Event Trigger component.
First, import the classes related to the EventTrigger.
Write code to delegate the EventTrigger. Through the delegate, you can define callback methods and call methods on behalf of others.
👍 Concept of Delegate
- A Delegate can be seen as a type of function pointer, which is an object that can reference and call a function.
- It can pass or return a function like a variable, and can also be passed as a parameter to other functions.
- In Unity, delegates are widely used for event handling. For example, you can connect a method to a delegate to have it automatically called whenever a specific event occurs.
Refer to the screen shown below.
Check the full code example for Event Trigger.
You can learn more about types of events supported by Unity and the EventTrigger by clicking the links below.
📘 Supported events https://docs.unity3d.com/kr/current/Manual/SupportedEvents.html