# Activate a gameobject that is disabled c#

**URL:** https://discussions.unity.com/t/activate-a-gameobject-that-is-disabled-c/80095
**Category:** Questions & Answers
**Created:** [August 25, 2013, 9:12pm UTC](https://discussions.unity.com/t/activate-a-gameobject-that-is-disabled-c/80095 "2013-08-25T21:12:23Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![aagrlp640](https://avatars.discourse-cdn.com/v4/letter/a/f475e1/32.png) [@aagrlp640](https://discussions.unity.com/u/aagrlp640)
#### Post date: [August 25, 2013, 9:12pm UTC](https://discussions.unity.com/t/activate-a-gameobject-that-is-disabled-c/80095/1 "2013-08-25T21:12:23Z")

</div>

Hi, I have a gameobject called Trees that have some trees inside, the probem is that it begins inactive or i can make it inactive with this code in c#:

```
if(Input.GetKeyUp(KeyCode.Space))
        {			
			GameObject.Find("Trees").active = false;
        }

```

I can disable, but i can’t activate it again using:

```
GameObject.Find("Trees").active = true;

```

I think unity don’t find the gameobject, is there a way to find it and activate it again.  
 ![14754-question.png](https://europe1.discourse-cdn.com/unity/original/3X/3/a/3af50afc1595c2a66ba0aa77c423e8a411357107.png)

Best regards

---

<div class="post-metadata">

### Author: ![Ejlersen](https://avatars.discourse-cdn.com/v4/letter/e/3da27b/32.png) [@Ejlersen](https://discussions.unity.com/u/Ejlersen)
#### Post date: [August 25, 2013, 9:25pm UTC](https://discussions.unity.com/t/activate-a-gameobject-that-is-disabled-c/80095/2 "2013-08-25T21:25:09Z")

</div>

Unity doesn’t find inactive game objects. Try creating a variable that holds the game object and use that to set the active bool.
