Welcome,
Guest
. Please
login
or
register
.
April 21, 2026, 09:39:29 PM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
How add new widget during runtime?
« previous
next »
Print
Pages: [
1
]
Author
Topic: How add new widget during runtime? (Read 9287 times)
jongsan83
Guest
How add new widget during runtime?
«
on:
April 17, 2012, 04:32:51 AM »
I want add widget during runtime by scripting.
How add new widget by scripting?
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: How add new widget during runtime?
«
Reply #1 on:
April 17, 2012, 04:35:11 AM »
UISprite newSprite
=
NGUITools
.
AddWidget
<
UISprite
>
(
parentGameObject
)
;
Logged
jongsan83
Guest
Re: How add new widget during runtime?
«
Reply #2 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.
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: How add new widget during runtime?
«
Reply #3 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.
Logged
jongsan83
Guest
Re: How add new widget during runtime?
«
Reply #4 on:
April 17, 2012, 05:42:02 AM »
Aha! Thanks!
Logged
alics
Guest
Re: How add new widget during runtime?
«
Reply #5 on:
February 06, 2013, 12:26:48 PM »
Is there a way to add widgets during runtime using Javascript?
UICreateWidgetWizard is in C#
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: How add new widget during runtime?
«
Reply #6 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.
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
How add new widget during runtime?