Tutorial by Examples

By default, one should subscribe to event using inspector, but sometimes it's better to do it in code. In this example we subscribe to click event of a button in order to handle it. using UnityEngine; using UnityEngine.UI; [RequireComponent(typeof(Button))] public class AutomaticClickHandler :...
Sometimes, you want to add listeners on particular events not natively provided by the components, in particular mouse events. To do so, you will have to add them by yourself using an EventTrigger component : using UnityEngine; using UnityEngine.EventSystems; [RequireComponent(typeof( EventTrig...

Page 1 of 1