Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Tatanan on September 11, 2014, 04:22:28 AM

Title: UI Camera events vs UI Event Trigger
Post by: Tatanan on September 11, 2014, 04:22:28 AM
I have been using UI Event Trigger to handle events on my sprites, but I am starting to guess I'm doing it wrong.
Why should I use UI Event Trigger (or even UI Button) if UI Camera is sending events and can get them on my scritps?
Title: Re: UI Camera events vs UI Event Trigger
Post by: ArenMook on September 12, 2014, 03:46:54 AM
UIEventTrigger can be used to trigger a remote function once an event you want arrives. It's the same thing as writing a script with the event function inside of it, such as OnClick, and doing the logic inside. Event trigger lets you have a cleaner approach where you don't need to write custom components for every button, but simply choose a function to call instead.

If you already have a custom script attached, don't use UIEventTrigger. If you want to trigger a function on a different game object, use UIEventTrigger.