How can i make my code more efficient?

i have some code which will spawn several hazards in specific locations but the code is rather long. is there a way to shorten it down?
using UnityEngine;
using System.Collections;

public class PowerDown : MonoBehaviour {

	public GameObject hazard;
		
		void Start ()
//		function OnTriggerEnter(collision: GameObject )
//		{ if(collision.transform.tag == "PowerD") { ScriptReference.active = true; } }
			{
			Vector3 spawnPosition = new Vector3 (-9, 7, 0);
			Quaternion spawnRotation = Quaternion.identity;
			Instantiate (hazard, spawnPosition, spawnRotation);

			
			spawnPosition = new Vector3 (-8, 7, 0);
			spawnRotation = Quaternion.identity;
			Instantiate (hazard, spawnPosition, spawnRotation);
			
			
			spawnPosition = new Vector3 (-7, 7, 0);
			spawnRotation = Quaternion.identity;
			Instantiate (hazard, spawnPosition, spawnRotation);
			
			
			spawnPosition = new Vector3 (-6, 7, 0);
			spawnRotation = Quaternion.identity;
			Instantiate (hazard, spawnPosition, spawnRotation);
			
			
			spawnPosition = new Vector3 (-5, 7, 0);
			spawnRotation = Quaternion.identity;
			Instantiate (hazard, spawnPosition, spawnRotation);
			
			
			spawnPosition = new Vector3 (-4, 7, 0);
			spawnRotation = Quaternion.identity;
			Instantiate (hazard, spawnPosition, spawnRotation);
			
			
			spawnPosition = new Vector3 (-3, 7, 0);
			spawnRotation = Quaternion.identity;
			Instantiate (hazard, spawnPosition, spawnRotation);
			
			
			spawnPosition = new Vector3 (-2, 7, 0);
			spawnRotation = Quaternion.identity;
			Instantiate (hazard, spawnPosition, spawnRotation);
			
			
			spawnPosition = new Vector3 (-1, 7, 0);
			spawnRotation = Quaternion.identity;
			Instantiate (hazard, spawnPosition, spawnRotation);
			
			
			spawnPosition = new Vector3 (0, 7, 0);
			spawnRotation = Quaternion.identity;
			Instantiate (hazard, spawnPosition, spawnRotation);
			
			
			spawnPosition = new Vector3 (1, 7, 0);
			spawnRotation = Quaternion.identity;
			Instantiate (hazard, spawnPosition, spawnRotation);
			
			
			spawnPosition = new Vector3 (2, 7, 0);
			spawnRotation = Quaternion.identity;
			Instantiate (hazard, spawnPosition, spawnRotation);
			
			
			spawnPosition = new Vector3 (3, 7, 0);
			spawnRotation = Quaternion.identity;
			Instantiate (hazard, spawnPosition, spawnRotation);
			
			
			spawnPosition = new Vector3 (4, 7, 0);
			spawnRotation = Quaternion.identity;
			Instantiate (hazard, spawnPosition, spawnRotation);
			
			
			spawnPosition = new Vector3 (5, 7, 0);
			spawnRotation = Quaternion.identity;
			Instantiate (hazard, spawnPosition, spawnRotation);
			
			
			spawnPosition = new Vector3 (6, 7, 0);
			spawnRotation = Quaternion.identity;
			Instantiate (hazard, spawnPosition, spawnRotation);
			
			
			spawnPosition = new Vector3 (7, 7, 0);
			spawnRotation = Quaternion.identity;
			Instantiate (hazard, spawnPosition, spawnRotation);
			
			
			spawnPosition = new Vector3 (8, 7, 0);
			spawnRotation = Quaternion.identity;
			Instantiate (hazard, spawnPosition, spawnRotation);
			
			
			spawnPosition = new Vector3 (9, 7, 0);
			spawnRotation = Quaternion.identity;
			Instantiate (hazard, spawnPosition, spawnRotation);
		}
	}

Is there a reason you’re setting those variables? You can pass the values directly to Instantiate…

Instantiate(hazard, new Vector3(-9, 7, 0), Quaternion.identity);
Instantiate(hazard, new Vector3 (-8, 7, 0), Quaternion.identity);
... etc ...

That will shorten it up quite a bit.

Another option would be to create them in the editor as children of an empty game object as position 0. Position them the way you want, then move the empty object somewhere way offscreen. When you’re ready to spawn them you can either move the empty object back to 0, or use instantiate to clone the empty object.

You could also create an array of positions and use the editor to edit those (do a search to find info on doing this).