Hi, I have a gameobject called Trees that have some trees inside, it begins inactive or I also can disable through this code in C#:
if(Input.GetKeyUp(KeyCode.Space)){
GameObject.Find("Trees").active = false;
}
But when i want to reactivate it with:
GameObject.Find("Trees").active = true;
unity can find the gameobject, is there a way to find it and activate it again?

Thanks for your answer!! :D sorry but im new in this of unity :( how can i set trees in the inspector?
– aagrlp640Drag your Trees GameObject into the serialized field Trees that will appear in the inspector. Example of a serialized field: [14757-serializedfield.png|14757] I realized I left out a brace in my code, I'll edit it.
– cmpgk1024Thanks for your help I found this solution foreach (GameObject go in GameObject.FindGameObjectsWithTag ("TreeTag")) { go.renderer.enabled = enabled; } Also work as you said :D
– aagrlp640The way you are doing it doesn't disable the GameObject - it just makes it invisible. If you want to change whether it is enabled, use
– cmpgk1024SetActive()with true or false.Can you send an example? its cause when i try to reactivate an gameboject y cant be restore, i read in some places that after inactive unity wont recognize it
– aagrlp640