Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: pushxtonotdie on September 23, 2015, 10:28:56 AM

Title: Using UIWidget as container object?
Post by: pushxtonotdie on September 23, 2015, 10:28:56 AM
Hi,

I'm currently coming on board to an NGUI 3 project that was built in a way that I'm unfamiliar with. Its been a while since I've used NGUI as well. I was curious if its considered normal practice to 'nest' components now. In NGUI 2 putting widgets in widgets was a bad thing to do.

Additionally the developers are using the UIWidget class (aka not a subclass of UIWidget) on its own in the hierarchy to contain other objects. Is this a normal thing to do? Back when I used NGUI you would use Panels to contain other objects. Is UIWidget the new Panel?
Title: Re: Using UIWidget as container object?
Post by: ArenMook on September 26, 2015, 04:33:39 PM
Yes, nesting is just fine and is often a good idea if you want to easily fade out something, as alpha is cumulative.

Using UIWidget on its own is also fine, as it's a blank invisible rectangle that is capable of receiving events if you put a collider on it.

UIWidget is not a new panel. Panel is what collects widgets and creates draw calls. UIWidget is just an invisible region that you can also use as a handy container. One example usage: making an interactable button that has a clickable region extending past its visible sprite.