title: SetActive(true) not working inside a coroutine
body: <p>I am using coroutines to manage cooldowns for powerups in my game. When the player collides with a powerup they will get the effect and a cooldown will start so they can't use it again for a certain amount of time.</p>
  
  <p>I am using coroutines to manage these cooldowns - setting the gameObject to false, waiting for the cooldown, then setting the <code>gameObject</code> back to true.</p>
  
  <p>My code:</p>
  
  
  
  <pre class="lang-c# prettyprint-override"><code>IEnumerator RespawnTime ()
  {
      gameObject.SetActive(false);
      Debug.Log("disabled");
  
      yield return new WaitForSeconds(3f);
  
      gameObject.SetActive(true);
      Debug.Log("enabled");
  }
  
  private void OnCollisionEnter2D (Collision2D collision)
  {
      // Health stuff goes in here.
      Debug.Log("Health regen!");
  
      // Start cooldown
      StartCoroutine(RespawnTime());
  }
  </code></pre>
  
  <p>However, the gameObject is never activated again once disabled. I don't think the problem is with the yield as commenting out the SetActive statements results in both debug messages being displayed at the correct times. </p>
  
  <p>Edit:</p>
  
  <p>Sorry, I didn't clarify. I know coroutines don't run on disabled <code>GameObjects</code>. I made a <code>PowerUpManager</code> script and it didn't work. Code:</p>
  
  <p>In the <code>PowerUp</code> script, in the <code>OnCollisionEnter2D</code> method</p>
  
  <pre class="lang-c# prettyprint-override"><code>StartCoroutines(PowerUpManager.RespawnTime(gameObject))
  </code></pre>
  
  <p>In the <code>PowerUpManager</code> script</p>
  
  <pre class="lang-c# prettyprint-override"><code>public static IEnumerator RespawnTime(GameObject powerUp)
  {
      powerUp.SetActive(false);
  
      yield return new WaitForSeconds(3f);
  
      powerUp.SetActive(true);
  }
  </code></pre>