Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: frarees on November 22, 2012, 04:17:12 PM
-
Hi,
Is there any way to create a full GUI just from code? Every time I need to create a GUI have to do it with the UI Wizard, and I'd like to know if dynamically generating the UI is possible/factible.
Thanks!
-
Of course. You'd just create gameobjects in a hierarchy and attach the script components in proper sequence. You can set all of the component variables and settings via code, too.
Caveat: Aren might correct the statements above if there is some under the hood magic that I'm not aware of.
-
Just look at the code of the UICreateWidgetWizard. All these widgets you're creating via the menu are created programmatically, and the code is available for you to examine, just like the rest of NGUI.
-
You can also instantiate a prefab containing the GUI to the correct panel. You might need to do some code scaling though.
-
Is there a way to add widgets during runtime using Javascript?
UICreateWidgetWizard is in C#
-
I answered you in the other thread. No need to ask twice.