How to make function last for X seconds?

I have a script where when my boomerang collides with an enemy, the enemy is disabled. However, the enemy is only set active for about half of a second. I want the enemy to be disable for 5 seconds (X seconds). Any help would be appreciated

Sorry, I’m new to Unity would like some guidance!
Thanks!

	void OnCollisionEnter (Collision other) {
		if (other.gameObject.tag == "Enemy")
		{
			other.gameObject.SetActive (false);
		}
	}

Remember: If you want behavior with delay / timer you have to insert it in “IEnumerator” and call it through “StartCoroutine”. Try this code:

void OnCollisionEnter (Collision other)
{
         if (other.gameObject.tag == "Enemy")
         {
             StartCoroutine (DisableEnemy (other.gameObject));
         }
 }

IEnumerator DisableEnemy (GameObject enemy)
{
   enemy.SetActive (false);

   yield return new WaitForSeconds (5f);

   enemy.SetActive (true);
}