- Home /
Best way to group child elements with NGUI?
I am writing some fairly complex guis at the moment and am trying to group elements together, partly for re-use via prefabs and partly so its easier to navigate, however if I make an ngui ui then under the panel add some empty game objects (to act like folder hierarchies) like "Background", "Content" for some reason the scalings go a bit wacky and so do the layerings.
As currently I want to have a similar theme for most components so I have a prefab which is a dummy game objects which contains a composition of NGUI elements to make a nice background, however I cannot see to get the content to appear in front of those elements when I group things under child empty elements.
So is there some best practise to grouping your elements and setting up NGUI widgets within prefabs so they can be reused without breaking the render order etc?
I had the same issue and found no workaround. For visibility, wonder if we can use a special Layer and change camera's culling mask at runtime.
Answer by smallbit · Jul 20, 2014 at 07:04 AM
I read somewhere that under NGUI root you should always use NGUI Widgets instead of empty GameObjects as a childs in your hierarchy (NGUI->Create->Widget). Cannot recall where I read this, but since I start to practice this, never had the problems you describe anymore. Also I put each menu window under separated NGUI panel, setting correct panel depth ensures correct layering.