CREATE YOUR WORLD
Scripting

UI Event

4min

ZEPETOScript has integrated support for the Unity UI system.

You can use different GUI components such as panels, buttons, text input box, and toggle menus to create the user interface in your world.

To use a unity UI elements in ZEPETOScript, you need to import them first.

UnityEngine.UI


Then, declare the Unity UI element you would like to add as a property.

TypeScript


The declared properties are now visible and accessible in the ZEPETOScript inspector window.

Document image


Open the Hierarchy window and drag and drop the Unity UI components into each property field in the ZEPETOScript inspector window. With the property values assigned, you can access and manipulate them from within the script. Use this to add a handler for any of the control’s events.

EventListener




Play to check that the UI event is handled properly.

Document image


Check the entire sample code.

UI_Event




You can learn more about Unity UIs that ZEPETOScript provide by clicking the links below.