Author Topic: Strange buttons behavior when iAd banner is active and clicked  (Read 3885 times)

MeDungeon

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 8
    • View Profile
I have 3 buttons in the middle of screen and iAd banner active at the bottom. When I touch banner I can see that one of those buttons much higher on screen is also clicked. Even more, when I move finger slowly on top of banner (from top to bottom) I can see that those buttons became hovered, which is not the case when I move finger over buttons itself. What could be wrong?
I have checked buttons colliders, they are all fine.
I have checked UICamera event mask and it is set to GUI layer only.

It seems that touch coordinates from banner translate to wrong screen coordinates by ngui. But why ngui reacting on those touches at all, I have checked that there is no collider under the banner.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Strange buttons behavior when iAd banner is active and clicked
« Reply #1 on: April 15, 2014, 09:26:03 AM »
Considering that the banner isn't NGUI, I'm guessing that you didn't add any kind of a collider underneath that would block the events from reaching NGUI.

MeDungeon

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: Strange buttons behavior when iAd banner is active and clicked
« Reply #2 on: April 17, 2014, 02:48:19 PM »
Considering that the banner isn't NGUI, I'm guessing that you didn't add any kind of a collider underneath that would block the events from reaching NGUI.
Sorry, I don't understand you. I have tried to add another widget with collider on the same panel but with depth 500, which should block bottom part of the screen. But it doesn't work. Buttons on top still magically receiving a tap event from iAd (not ngui of course, just standard iAd banner). I log tap coordinates received by buttons and they looks like I definitely clicking a button on top.
Any ideas what may caused it?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Strange buttons behavior when iAd banner is active and clicked
« Reply #3 on: April 18, 2014, 03:43:16 PM »
Remove the banner. Can you still click on the buttons blocked by the depth 500 widget?

MeDungeon

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: Strange buttons behavior when iAd banner is active and clicked
« Reply #4 on: April 19, 2014, 06:36:08 AM »
Remove the banner. Can you still click on the buttons blocked by the depth 500 widget?

I tested a little bit more, I put that blocker widget on top of buttons as well, it successfully blocked them from receiving events from banner as well.
But I need them to be active on screen together with banner. Is something wrong with guicamera? Maybe event mask doesn't work correctly?

PS. I'm using Render Queue for that buttons panel: explicit = 2081
May that affect somehow?
« Last Edit: April 19, 2014, 04:07:49 PM by MeDungeon »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Strange buttons behavior when iAd banner is active and clicked
« Reply #5 on: April 19, 2014, 11:02:15 PM »
Draw order of cameras is based on the camera's depth. Events are based on panel's depth. So first -- camera depth, then panel depth, then widget depth. Render queue has no effect here. It's only for drawing.

MeDungeon

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: Strange buttons behavior when iAd banner is active and clicked
« Reply #6 on: April 20, 2014, 09:48:51 AM »
Draw order of cameras is based on the camera's depth. Events are based on panel's depth. So first -- camera depth, then panel depth, then widget depth. Render queue has no effect here. It's only for drawing.
That's good.
Any ideas how it is possible for 3rd party view, which is not even in Unity, to interfere with NGUI ontouch events?
I have tried to reduce gui camera viewport, so it will not intersect with banner at all, but that didn't help, any banner touch recognized by NGUI as scaled by banner height screen, so tapping on banner y= 10, recognized by ngui as tap on screen y=100 or something.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Strange buttons behavior when iAd banner is active and clicked
« Reply #7 on: April 20, 2014, 04:38:05 PM »
All NGUI does is grabs the input from Unity via Input.GetTouch etc. I don't know what your third party app does.

SmartyP

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: Strange buttons behavior when iAd banner is active and clicked
« Reply #8 on: May 28, 2014, 03:37:55 PM »
I'm running into this same issue. Specifically I am using the iOS Natives Unity plugin which has iAd support. My NGui buttons are on a 3D object, and finger presses to the banner at the bottom of the screen are causing touch over/down events on my GUI. It is not that the taps are falling through the banner as the banner is at the bottom, whereas the taps are being interpreted by buttons higher up on the screen (at least as they appear on the 3D object). Unfortunately the NGUI tap event fires before the iAD event, so I can't disable the nGUI button in time..

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Strange buttons behavior when iAd banner is active and clicked
« Reply #9 on: May 29, 2014, 06:07:44 AM »
Create an invisible NGUI widget (ALT+SHIFT+W) and add a collider to it (ALT+SHIFT+C). Resize it to cover your banner, and give it a high depth value so that it's in front of everything. And there you go, you've now blocked input from falling through to your game objects.