When I use the Pointer Up and Pointer Down triggers on a prefab that is already in the hierarchy, they work fine. But when I try to use the triggers on an instantiated prefab, they don’t work.
Any idea how to solve this?
When I use the Pointer Up and Pointer Down triggers on a prefab that is already in the hierarchy, they work fine. But when I try to use the triggers on an instantiated prefab, they don’t work.
Any idea how to solve this?
You need to define and callback in the script
EventTrigger event_trigger = GetComponent();
event_trigger.triggers[0].callback.AddListener((eventData) => { yourMethod1(); });
event_trigger.triggers[1].callback.AddListener((eventData) => { yourMethod2(); });
triggers[0] is defined in the inspector,(for example it is pointerup)
triggers[1] is defined in the inspector,(for example it is pointerdown)