Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: vexir on October 01, 2014, 05:28:06 PM

Title: Button Scale Affects Collider
Post by: vexir on October 01, 2014, 05:28:06 PM
UIButtonScale seems to affect the collider's scale as well. This results in issues where the scaling causes the collider to no longer be under the finger and the touch gets thrown out. Is this something that you're aware of?
Title: Re: Button Scale Affects Collider
Post by: ArenMook on October 01, 2014, 05:30:14 PM
Can't say that I am. What's your setup?
Title: Re: Button Scale Affects Collider
Post by: vexir on October 01, 2014, 06:58:39 PM
NGUI 3.6.3. Might be a little risky to at this stage in the project; though I would if it fixed this. UI Root set to Fixed Size On Mobiles. Standard UIButtons with UIButtonScale script on them. Testers keep trying to press buttons on the edge of collision at which point it drops out and doesn't register as a press.
Title: Re: Button Scale Affects Collider
Post by: vexir on October 01, 2014, 07:01:19 PM
Another note - you can tell it happens because although the button stays scaled, the color reverts back to a non-pressed color.
Title: Re: Button Scale Affects Collider
Post by: ArenMook on October 02, 2014, 09:59:00 PM
Yeah that's 11 versions behind, can't say much about that.
Title: Re: Button Scale Affects Collider
Post by: huhudage on December 22, 2014, 02:06:38 AM
This problem seems still exists in 3.7.6, how to resolve this?
Title: Re: Button Scale Affects Collider
Post by: ArenMook on December 22, 2014, 10:22:51 AM
So what's the issue exactly? How do I reproduce it?
Title: Re: Button Scale Affects Collider
Post by: huhudage on December 22, 2014, 09:21:48 PM
So what's the issue exactly? How do I reproduce it?

If attach a UIButtonScale component to a button, with (1, 1, 1) as 'Hover' property and (0.8, 0.8, 0.8 ) as 'Pressed' property, when I press at edge of the button, the OnPress callback will not be triggered because the collider is no longer under my finger.
Title: Re: Button Scale Affects Collider
Post by: ArenMook on December 23, 2014, 12:02:57 PM
Oh, well yeah. Collider won't be underneath that button anymore after the scaling operation.

If you want the collider to stay the same size, then you need to separate it from the viewable component like so:

UIWidget (collider, button component)
- Sprite (visible sprite that will scale)