Title: Re: How add new widget during runtime?
Post by: jongsan83 on April 17, 2012, 05:05:59 AM
I want add button, add checkbox, set atlas, etc... by scripting.
I tried find example, but nothing.
If you know site that contains example, write site address plz.
Title: Re: How add new widget during runtime?
Post by: ArenMook on April 17, 2012, 05:14:01 AM
Look inside UICreateWidgetWizard. Every single widget added via the Create Widget Tool is created via code, and it's all inside that file.
Title: Re: How add new widget during runtime?
Post by: jongsan83 on April 17, 2012, 05:42:02 AM
Aha! Thanks!
Title: Re: How add new widget during runtime?
Post by: alics on February 06, 2013, 12:26:48 PM
Is there a way to add widgets during runtime using Javascript?
UICreateWidgetWizard is in C#
Title: Re: How add new widget during runtime?
Post by: ArenMook on February 06, 2013, 10:14:25 PM
It's an editor script, so you wouldn't be able to call its functions at run-time. I highly suggest you not even trying to. Simply create a prefab out of an ideal item (for example create a single row in a table, then save it as a prefab). Then when you instantiate this prefab using NGUITools.AddChild, just change its values. It's hell of a lot easier than adding widgets by code.
However... if you do insist on adding things via code -- just copy/paste logic from inside that script. You will need to translate it from C# to Javascript though.