No instantiation ?

Im trying to instantiate items depending on time however for some reason it just doesnt work, here is the code

using UnityEngine;
using System.Collections;

public class lvl1 : MonoBehaviour {
	
	public Transform prefab1;
	public Transform prefab2;
	public Transform prefab3;
	public float myTimer = 0.0f;
	
	
	void Start()
	{
		
		
	}
	
	// Update is called once per frame
	void Update ()
	{
		if (myTimer >= 0) {
			myTimer += Time.deltaTime;
		}
		if (myTimer == 3) {

			Spawn ( 1 );
			Spawn ( 2 );
			Spawn ( 3 );
			Spawn ( 7 );
			Spawn ( 8 );
			
			
		}
		if (myTimer == 4) {
			
			Spawn ( 1 );
			Spawn ( 2 );
			Spawn ( 6 );
			Spawn ( 7 );
			Spawn ( 8 );
			
			
		}
		if (myTimer == 5) {
			
			Spawn ( 1 );
			Spawn (5 );
			Spawn ( 6 );
			Spawn ( 7 );
			Spawn ( 8 );
			
			
		}
	}
	
	
	
	void Spawn (int p)
	{
		if (p== 1) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab1, new Vector3(-9, 0, 17) , Quaternion.Euler (x2, y2, z2)) ;
			
			
			
			Debug.Log("p=1");
		}  
		if (p== 2) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab1, new Vector3(-6, 0, 17) , Quaternion.Euler (x2, y2, z2)) ;
			
			Debug.Log("p=2");
		}  
		if (p== 3) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab1, new Vector3(-4, 0, 17) , Quaternion.Euler (x2, y2, z2)) ;
			
			Debug.Log("p=3");
		}  
		if (p== 4) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab1, new Vector3(-1, 0, 17) , Quaternion.Euler (x2, y2, z2)) ;
			
			Debug.Log("p=4");
		}  
		if (p== 5) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab1, new Vector3(1, 0, 17) , Quaternion.Euler (x2, y2, z2)) ;
			
			Debug.Log("p=5");
		}  
		if (p== 6) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab1, new Vector3(3, 0, 17) , Quaternion.Euler (x2, y2, z2)) ;
			
			
			Debug.Log("p=6");
		}  
		if (p== 7) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab1, new Vector3(6, 0, 17) , Quaternion.Euler (x2, y2, z2)) ;
			
			
			Debug.Log("p=7");
		}  
		if (p== 8) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			
			Instantiate( prefab1, new Vector3(8, 0, 17) , Quaternion.Euler (x2, y2, z2)) ;
			
			Debug.Log("p=8");
		}  
		if (p== 9) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab2, new Vector3(14, 0, 9) , Quaternion.Euler (x2, y2, z2)) ;
			
			Debug.Log("p=9");
		}  
		if (p== 10) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab2, new Vector3(14, 0, 7) , Quaternion.Euler (x2, y2, z2)) ;
			
			Debug.Log("p=10");
		}  
		if (p== 11) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab2, new Vector3(14, 0, 5) , Quaternion.Euler (x2, y2, z2)) ;
			
			Debug.Log("p=11");
		}  
		if (p== 12) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab2, new Vector3(14, 0, 3) , Quaternion.Euler (x2, y2, z2)) ;

			
			
			Debug.Log("p=12");
		}  
		
		if (p== 13) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab2, new Vector3(14, 0, 1) , Quaternion.Euler (x2, y2, z2)) ;
			
			
			Debug.Log("p=13");
		}  
		if (p== 14) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			
			Instantiate( prefab2, new Vector3(14, 0, 0) , Quaternion.Euler (x2, y2, z2)) ;
			
			Debug.Log("p=14");
		}  
		if (p== 15) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab3, new Vector3(-14, 0, 0) , Quaternion.Euler (x2, y2, z2)) ;
			
			Debug.Log("p=15");
		}  
		if (p== 16) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab3, new Vector3(-13, 0, 4) , Quaternion.Euler (x2, y2, z2)) ;
			
			Debug.Log("p=16");
		}  
		if (p== 17) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab3, new Vector3(-14, 0, 5) , Quaternion.Euler (x2, y2, z2)) ;
			
			Debug.Log("p=17");
		}  
		if (p== 18) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab3, new Vector3(-23, 0, 0) , Quaternion.Euler (x2, y2, z2)) ;
			
			Instantiate( prefab3, new Vector3(-14, 0, 5) , Quaternion.Euler (x2, y2, z2)) ;
			
			
			Debug.Log("p=18");
		}  
	}}

Do not rely on float comparison. You’ll most-likely never exactly hit 3, 4, 5 etc due to the imprecision of floating point numbers.
Use a threshold, an approximation or ‘>=’ (or less than respectively).

@mkobaner
You can try using (int) before the float p value in the if statement.

for ex:

if((int)p == 1f)
{
//Do Instantiation here...
}

Remember p is the float value here.

Hope this may help you.

Well after abit of trial and error i found a fix like this, interestingly it created a different mechanic in game, works for me .

using UnityEngine;
using System.Collections;

public class lvl1 : MonoBehaviour {
	
	public Transform prefab1;
	public Transform prefab2;
	public Transform prefab3;
	public float myTimer = 0.0f;
	public int inttime;

	public float stoptime= 0.0f;
	public float sp=2.0f;

	void Start()
	{
		
		
	}
	
	// Update is called once per frame
	void Update ()
	{

		stoptime -=Time.deltaTime;
		if (myTimer >= 0) {
			myTimer += Time.deltaTime;
		}

		inttime = Mathf.RoundToInt (myTimer);
		if (inttime == 1&&stoptime<=0) {

			Spawn ( 1 );
			Spawn ( 2 );
			Spawn ( 3 );
			Spawn ( 7 );
			Spawn ( 8 );
			
			
		}
		if (inttime == 2&&stoptime<=0) {
	
			Spawn ( 1 );
			Spawn ( 2 );
			Spawn ( 6 );
			Spawn ( 7 );
			Spawn ( 8 );
			
			
		}
		if (inttime == 3&&stoptime<=0) {
	
			Spawn ( 1 );
			Spawn (5 );
			Spawn ( 6 );
			Spawn ( 7 );
			Spawn ( 8 );
			}
	}
	
	
	
	void Spawn (int p)
	{
		stoptime=sp;
		if (p== 1) {

			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab1, new Vector3(-9, 0, 17) , Quaternion.Euler (x2, y2, z2)) ;
			
			
			
			Debug.Log("p=1");
		}  
		if (p== 2) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab1, new Vector3(-6, 0, 17) , Quaternion.Euler (x2, y2, z2)) ;
			
			Debug.Log("p=2");
		}  
		if (p== 3) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab1, new Vector3(-4, 0, 17) , Quaternion.Euler (x2, y2, z2)) ;
			
			Debug.Log("p=3");
		}  
		if (p== 4) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab1, new Vector3(-1, 0, 17) , Quaternion.Euler (x2, y2, z2)) ;
			
			Debug.Log("p=4");
		}  
		if (p== 5) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab1, new Vector3(1, 0, 17) , Quaternion.Euler (x2, y2, z2)) ;
			
			Debug.Log("p=5");
		}  
		if (p== 6) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab1, new Vector3(3, 0, 17) , Quaternion.Euler (x2, y2, z2)) ;
			
			
			Debug.Log("p=6");
		}  
		if (p== 7) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab1, new Vector3(6, 0, 17) , Quaternion.Euler (x2, y2, z2)) ;
			
			
			Debug.Log("p=7");
		}  
		if (p== 8) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			
			Instantiate( prefab1, new Vector3(8, 0, 17) , Quaternion.Euler (x2, y2, z2)) ;
			
			Debug.Log("p=8");
		}  
		if (p== 9) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab2, new Vector3(14, 0, 9) , Quaternion.Euler (x2, y2, z2)) ;
			
			Debug.Log("p=9");
		}  
		if (p== 10) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab2, new Vector3(14, 0, 7) , Quaternion.Euler (x2, y2, z2)) ;
			
			Debug.Log("p=10");
		}  
		if (p== 11) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab2, new Vector3(14, 0, 5) , Quaternion.Euler (x2, y2, z2)) ;
			
			Debug.Log("p=11");
		}  
		if (p== 12) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab2, new Vector3(14, 0, 3) , Quaternion.Euler (x2, y2, z2)) ;

			
			
			Debug.Log("p=12");
		}  
		
		if (p== 13) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab2, new Vector3(14, 0, 1) , Quaternion.Euler (x2, y2, z2)) ;
			
			
			Debug.Log("p=13");
		}  
		if (p== 14) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			
			Instantiate( prefab2, new Vector3(14, 0, 0) , Quaternion.Euler (x2, y2, z2)) ;
			
			Debug.Log("p=14");
		}  
		if (p== 15) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab3, new Vector3(-14, 0, 0) , Quaternion.Euler (x2, y2, z2)) ;
			
			Debug.Log("p=15");
		}  
		if (p== 16) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab3, new Vector3(-13, 0, 4) , Quaternion.Euler (x2, y2, z2)) ;
			
			Debug.Log("p=16");
		}  
		if (p== 17) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab3, new Vector3(-14, 0, 5) , Quaternion.Euler (x2, y2, z2)) ;
			
			Debug.Log("p=17");
		}  
		if (p== 18) {
			float x2 = Random.Range (0.0F, 360.0F);
			float y2 = Random.Range (0.0F, 360.0F);
			float z2 = Random.Range (0.0F, 360.0F); 
			Instantiate( prefab3, new Vector3(-23, 0, 0) , Quaternion.Euler (x2, y2, z2)) ;
			
			Instantiate( prefab3, new Vector3(-14, 0, 5) , Quaternion.Euler (x2, y2, z2)) ;
			
			
			Debug.Log("p=18");
		}  
	}}