Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: agentsmith666 on June 05, 2013, 10:20:00 PM

Title: How do I ignore clicks/taps when a menu is in front of a button?
Post by: agentsmith666 on June 05, 2013, 10:20:00 PM
I have a button that when pressed brings up a menu that covers a large portion of the screen.  It's in front of the player's controls.  This menu can scroll up and down however any clicks/taps on the Menu UI the buttons underneath also receive them.  Is there a setting (layer, z-axis, etc) that I can give the menu to take the clicks/taps and block them from going through to the other buttons or do I have to disable the buttons (lame) while the Menu is displayed?

Thanks.
Title: Re: How do I ignore clicks/taps when a menu is in front of a button?
Post by: ArenMook on June 06, 2013, 07:50:19 AM
Add a collider to the window's background. Collider will intercept the events.
Title: Re: How do I ignore clicks/taps when a menu is in front of a button?
Post by: agentsmith666 on June 07, 2013, 02:41:41 PM
Hmm still doesn't work;  they're of the same atlas and currently the same z-axis.  I tried playing the z-axis and nothing.   I even made the collider on the background 10 times larger and nothing.  I tried it as a trigger and a normal collider.  Any ideas?

Anchor
       --> Panel
                 --> Background (has collider)
                              --> Button ( I can press it; works normally )
      --> Panel
                --> Button ( also works but I want to block )


Update 1:
When I put the collider on the Panel that has the background it blocks on clicks on the background but they still go through to the other panel with the button

Update 2:
It appears that by default but when I add an NGUI button to a panel it adds a collider at Z=-2.  If I put the background collider  -3 then it blocks it.. Why is NGUI putting the button colliders at z = -2? Should I change them all to zero?
Title: Re: How do I ignore clicks/taps when a menu is in front of a button?
Post by: ArenMook on June 07, 2013, 03:23:59 PM
This is why I said "background" not "panel".

When you add a collider to the background, it will use only the background's Z to determine its offset.

When you add a collider to the panel, it will calculate the Z based on ALL the widgets present within the panel.
Title: Re: How do I ignore clicks/taps when a menu is in front of a button?
Post by: agentsmith666 on June 07, 2013, 06:37:26 PM
I did add it to the background and didn't work.  I added it to he panel and it works.  If I understand you correctly I should re-add it to the background, remove it from the Panel, and check the z-axis'?

Update 1:
It's working.  Thanks.