Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: imnemone on March 28, 2013, 11:00:21 PM
-
Hello.
I want to make shop window as a prefab.
Because, It doesn't need to loaded at start.
I want to create the "shop window" when user click the ShopButton in the main screen.
If I make shop window as prefab, I lost button's target it is GUIManager gameObject.
There is many buttons in the show window.
I have no idea.
I need some advice please.
Thx.
-
If you make it as a prefab and want to load it dynamically, you have to save it in a Resources folder (or subfolder to that) and use Resources.Load to load the prefab by name. Then you can instantiate it to make a copy of the prefab and there you go.
-
Yes, I did already.
But, When I instantiate the prefab , all buttons target lost its target.
So, I manually assign target to every button in script.
Is there other method ?
Assigning target of buttons is put me to trouble.
Thx.
-
Anything outside the prefab is effectively unknown when you instantiate the prefab. So if your button has public references to something outside the prefab, you will lose this reference. That's just how Unity works.