Author Topic: *BUG* UIGrid under ScrollView with NGUITools.AddChild colliders broken  (Read 2192 times)

directedchaos

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 5
    • View Profile
Hello,

I have this structure (UIGrid under a ScrollView, instantiating objects under the UIGrid):
ScrollView
|-UIGrid
|--SomethingWithCollidersLikeAButton(Copy)
|--SomethingWithCollidersLikeAButton(Copy)
[...]

I call NGUITools.AddChild(UIGrid, SomethingWithCollidersLikeAButton).  The colliders don't hit -- no matter what I do.  I move them in the editor so nothing is over them, change the z-order, change the parent (so it's not even under the UIGrid, or ScrollView, etc.)... nothing.  UICamera debug is on and not showing it.  Another interesting bit: when I move them, visually they don't move until I disable and re-enable the object.

If I add them to the ScrollView directly, it works.  If I add them to anything else then move them (in the editor) to the UIGrid, it works.  If it use a UITable instead, it works.  So it's probably a bug with the UIGrid.  I'm using UITable for now, and my overall setup is pretty complex so it's hard to give a simple example, but hopefully this helps find the bug and warns others who may hit this.  I'm on the latest (3.8, but I hit this before updating too, not sure how old).

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
What version of Unity? There was a bug in Unity 4.6 to earlier 5.0 versions that wouldn't update collider positions properly. It was supposedly fixed in the latest Unity version. I know 4.5 works properly. Also, if it's not seeing your buttons, what does it show as being underneath the mouse?