The button i added in a table inside a scroll view, if this matters. However if I add the button manually, it works fine, but if I add it via script in does not respond on clicks.
any idea?
Title: Re: UIButton added via script not responding to clicks
Post by: ArenMook on April 23, 2017, 06:23:17 AM
Check the layer the object is on, make sure it has a collider, and that the collider is properly sized.
Title: Re: UIButton added via script not responding to clicks
Post by: bbfy on May 04, 2017, 07:17:36 AM
@ArenMook I followed this Tutorial:
https://www.youtube.com/watch?v=UK3aMHRfgcw
So I do have a layer, a WidgetLayer to scroll. What is really unusual, If I add the items manually, so before run, clicks are working. Right now I removed this layer to scroll and have a scrollbar (ugly solution)
Title: Re: UIButton added via script not responding to clicks
Post by: ArenMook on May 04, 2017, 05:00:35 PM
If one way is working and the other doesn't, it should be pretty easy to check them in inspector to see what differs. :)
How are you adding whatever it is you're adding? Did you double-check their layers and make sure the transform's parent is what it should be? If you set your parent manually after Start(), (such as when using a pool of objects) use NGUITools.MarkParentAsChanged() to notify NGUI that the parent has been changed.