Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: hazzy on February 06, 2013, 09:23:53 PM
-
Hey all,
I have a UIDraggable panel with a UIGrid that has UIButtons added and removed from it based on certain events.
I have made a prefab that contains everything I want from that button (background, text label, sprite checkbox, etc). This prefab works perfectly if I drag it by hand to the grid in my scrollable panel. However, when I add it using NGUITools.AddChild and pass the grid and the prefab name, the button simply stops working. Hover/pressed colors don't change, OnClick() doesn't fire, etc. Is there a workaround for this or am I missing something?
Thanks in advance.
-
When you use AddChild, the object you are instantiating assumes the game object layer of the parent.
Make sure it's what you expect it to be.
-
Thanks! Worked like a charm. The Grid GameObject was moved to DefaultLayer instead of my NGUI layer and moving it back worked perfectly.