- Home /
How to Enable bunch of GUIText which is placed inside Gameobject ?
I placed a bunch of GUIText and GUITextures placed inside an GameObject...And i want them to be enabled only at some condition, So do it need to give,
firstGUIText.enable = true
for each and every GUIText or any other way is possible ??
I tried by disabling GameObject itself at the start of game and tried to make it active during the game...but the de activated GameObject cannot be located using GameObject.Find....
So Any help is highly appreciated..Thank you....
Sorry guys...I think i can have a prefab and instantiate it at that point of time.....
is that correct way ?
Thats the Better Way.You can Create the Prefab of the Parent Game object and Call it Using Resource .Load() function. Good luck..
Am using GUI at specified locations and moved it to prefab now, so while instantiating which position i need to provide ? The one line i used below doesn't seem to work....Please help on this...
var trans = Instantiate(GUIs, transform.position,transform.rotation) as Transform;
The log says GUIs(clone) but nothing is visible on the screen.
Answer by Unity_gamer · Oct 01, 2012 at 06:31 AM
Make sure the Game Object is in the Resource folder and try this to Instantiate the Prefab.
var instance : GameObject = Instantiate(Resources.Load("YOUR GAME OBJECT"),Vector3(0,0,0),Quaternion.identity);
If you have any doubt refer this.
http://docs.unity3d.com/Documentation/ScriptReference/Resources.Load.html
I used the code u gave, but unfortunately got some 3 errors...But the link u gave solved my problem,
I used,
var instance = Instantiate(Resources.Load("GUIOffers", typeof(GameObject)));
Thanks a lot for your help :-)
Your answer
Follow this Question
Related Questions
(For Loop) Converting Gui Button to GuiText & GuiTexture 1 Answer
I can't print a int.ToString() variable in a guiText.text 1 Answer
Change guiText to TextMesh? 1 Answer
C# 2d Instantiate GUIText and lock it to position on map, not to follow camera. 1 Answer
GUItext works 1 of 3 situations? 0 Answers