Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: MaxUylings on September 20, 2012, 05:05:07 AM

Title: UIButton fires twice.
Post by: MaxUylings on September 20, 2012, 05:05:07 AM
Hello,

We just bought the NGUI extension and have just started to play around with it.
The thing I noticed is that sometimes the UIButton fires twice. And also sometimes it stays on the "Pressed" status of the button. Is there a way to avoid this?

Kind Regards,
Max Uijlings
Title: Re: UIButton fires twice.
Post by: PhilipC on September 20, 2012, 09:31:52 AM
This isnt something i've noticed before unless your using iOS and Unity remote. can you give any more details?
Title: Re: UIButton fires twice.
Post by: MaxUylings on September 21, 2012, 04:02:52 AM
I am using IOS with Unity remote. So I assume that what you are suggesting is that when I deploy it to the iPhone this behaviour will not occur?

Kind Regards,
Max Uijlings
Title: Re: UIButton fires twice.
Post by: ArenMook on September 21, 2012, 08:16:00 AM
Yup.
Title: Re: UIButton fires twice.
Post by: MaxUylings on September 21, 2012, 08:52:29 AM
Could you maybe tell me why this happens when using the unity remote? This way when I have a similar thing in the future I understand what happens and I can recognise when it is the remote and when it is a real problem.

kind regards
Title: Re: UIButton fires twice.
Post by: ArenMook on September 21, 2012, 09:24:48 AM
Because it sends both mouse and touch events, and NGUI treats both equally. Select the UICamera and uncheck the mouse events.
Title: Re: UIButton fires twice.
Post by: MaxUylings on September 21, 2012, 09:38:35 AM
I unchecked the mouse events in the UICamera, but I still have it fire twice sometimes.
Title: Re: UIButton fires twice.
Post by: MaxUylings on September 21, 2012, 10:32:36 AM
I just ran the app on my iPhone and the problem was indeed gone. So thanks for the clarification. I now know not to trust the remote to much and will do my testing and debugging on the device again. To bad because the remote was a very nice and fast solution compared to building and running every time.

Kind Regards,
Max
Title: Re: UIButton fires twice.
Post by: squish007 on April 26, 2014, 09:42:45 PM
i had this same problem, turns out it was because i had the button call an OnClick() function. i changed the function name to ButtonPressed() and it no longer fired twice.