Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: basil_11 on October 16, 2012, 09:25:17 PM

Title: How to create Image buttton DYNAMICALLY
Post by: basil_11 on October 16, 2012, 09:25:17 PM
I'm new in NGUI and I want to create UIImageButton Dynamically after clicking a Button.

can you please give me some tips or sample codes on how to do it thanks!!!
Title: Re: How to create Image buttton DYNAMICALLY
Post by: Nicki on October 17, 2012, 02:11:53 AM
You add the relevant components and collider to the gameobject you want to become a button.

Or you use NGUITools.AddChild with a reference to a prefab where you have designed the button already.
Title: Re: How to create Image buttton DYNAMICALLY
Post by: basil_11 on October 17, 2012, 02:30:48 AM
Thanks for the tips.. can you give me some Sample scripts? I'm just new in NGUI :)

Creating a UIImageButton using a program/Script
Title: Re: How to create Image buttton DYNAMICALLY
Post by: Nicki on October 17, 2012, 04:21:57 AM
Make one with the widget tool (top menu: NGUI->Create a widget) and see what components it puts on it, then you can recreate the same in code with a helper script.

Or look at the examples provided with the package.