Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: directedchaos on March 11, 2015, 02:35:53 AM

Title: *BUG* UIGrid under ScrollView with NGUITools.AddChild colliders broken
Post by: directedchaos on March 11, 2015, 02:35:53 AM
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).
Title: Re: *BUG* UIGrid under ScrollView with NGUITools.AddChild colliders broken
Post by: ArenMook on March 12, 2015, 07:43:44 PM
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?