How do I Instantiate a new game object from destroyed object?

I’ve been working with the space shooter tutorial and I’ve been trying to take it further. I’ve created pickups for a weapon upgrade and a health. I would like to have these pickups appear randomly when an asteroid is destroyed (the weapon pickup ~50 and health ~100 asteroid). I had a friend mention that it could done under the “yield new return” section of my code but I’m still not sure how to instantiate them.

public GameObject weapon;
public GameObject health;

IEnumerator SpawnWaves ()
{
	yield return new WaitForSeconds (startWait);
	while (true)
	{
		for (int i = 0; i < hazardCount; i++) {
				Vector3 spawnPosition = new Vector3 (Random.Range (-spawnValue.x, spawnValue.x), spawnValue.y, spawnValue.z);
				Quaternion spawnRotation = Quaternion.identity;
				Instantiate (hazard, spawnPosition, spawnRotation);
				yield return new WaitForSeconds (spawnWait);
			}
			yield return new WaitForSeconds (waveWait);

			if (gameOver)
			{
				restartText.text = "Press 'R' to Restart";
				restart = true;
				break;
			}
		}
	}

The code you showed us shouldnt even compile as you don’t define the “hazard” variable anywhere.

if this is only part of the class you probably want to show us the whole class, and clearly explain what its not doing.