Author Topic: NGUI sees button colliders with wrong y-offset  (Read 3787 times)

mtoivo

  • Guest
NGUI sees button colliders with wrong y-offset
« on: October 13, 2012, 07:34:40 AM »
Hi.

I'm having a bit weird behaviour on my buttons. The box colliders seem to be little too low on y-axis. They're off about half of the sprites height, or at least that's how NGUI reacts to them. The colliders themselves are right were they're supposed to, tightly over the sprite (I've alt-shift-c'd them to be sure and visually they are just right). I have another camera (perspective) doing raycasts on my scene for objects outside NGUI, and it seems to hit the buttons just fine. Anything special I should check?

My UI is simple 2D, I'm using newest NGUI available on the asset store (2.2.2).

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI sees button colliders with wrong y-offset
« Reply #1 on: October 13, 2012, 08:26:13 AM »
What's the depth value? The higher the depth value, the more the colliders get offset.

mtoivo

  • Guest
Re: NGUI sees button colliders with wrong y-offset
« Reply #2 on: October 13, 2012, 02:10:19 PM »
Why? Shouldn't they stay the same on 2D UI? Makes no sence in my opinion to move collider off the sprite. And the box colliders frame does not seem to be actually offsetted, and regular raycasting hits the box just fine. Offsettig z-value would make sense, but all colliders seem to be off about the same amount downwards, doesn't matter what the depth value is, happens with 0, 1, -1 etc all the same.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI sees button colliders with wrong y-offset
« Reply #3 on: October 14, 2012, 04:41:19 AM »
Without physically bringing colliders forward, there is no way for physics to respond properly. Raycast into the scene -- which widget is hit? This is determined by physics. Keep in mind that after adjusting depth, you need to re-adjust the collider (if there is one) via NGUI menu -> Add Collider.