Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Ironic Chef on October 29, 2014, 06:52:05 PM

Title: Buttons Not Communicating Trigger Events
Post by: Ironic Chef on October 29, 2014, 06:52:05 PM
A couple of days ago I upgraded from the March version of NGUI and suddenly my buttons stopped working during screen fade in/out events.

After a lot of investigation this seems to be a problem that's resulting from Unity providing invalid responses to touch/input events. While I can't find the precise cause of NGUI getting bogus input states, I was able to work around the issue by identifying my input objects within the NGUI code and forcibly setting the click-state to true when one is encountered. Yeah, I had to hack the NGUI code to deal with this.

Basically I've added a check to NGUI that says "if a collsion object has a specified prefix then ALWAYS treat it as being a valid collision (button press)". Doing this has eliminated the non-responsive button issue, but only works because I went to the effort of insuring all my button GameObjects had "bt" prepended to their names.

So, likely a Unity issue, but certainly one that everyone should be aware of.

                                   Nick
Title: Re: Buttons Not Communicating Trigger Events
Post by: ArenMook on October 30, 2014, 12:11:05 PM
Invalid states in what sense? Make sure the UICamera's type is set to "3D UI", not "3D World".
Title: Re: Buttons Not Communicating Trigger Events
Post by: Ironic Chef on October 30, 2014, 12:45:19 PM
The mouse button / fake touch events are being polled from "Input", but "Input" is reporting that the mouse/touch event is false.

See lines 1485-1487 in UICamera. For some reason the query responds with false/false regardless of physical inputs (this was equally true in both the editor and on IOS devices).

It's not NGUI's fault - it's something strange happening in Unity that I've been unable to isolate. Fortunately I can use the name of "hoveredObject" to detect that an event is occurring over a button based on it's prefix.

I tried every permutation of setting prior to digging into NGUI's guts to tack down what was actually going on :)