My code Instantiates a spider every frame and not one once

My code Instantiates a spider every frame, so i have too many spiders which is slowing down the game. I need the spider to only Instantiate once every 3 seconds.

My class is below;

using UnityEngine;
using System.Collections;

public class EnemyStats : MonoBehaviour {
	public int SpidersLeft1 = 4;
	public int SpidersLeft2 = 4;
        int SpidersLeft;
	public GameObject secondKey;
	public GameObject spawnSpider1;
	public GameObject spawnSpider2;
	
void Start () {
			}

	void Update(){
		SL1(0);
		SL2(0);
		}

	public void SL1(int Reducer){
		SpidersLeft1+= Reducer;
		if (SpidersLeft1 <= 0) {
			SpidersLeft1 = 0;
			Instantiate(secondKey);
		}
		if (SpidersLeft1 > 0) {
			//Instantiate(spawnSpider1);
			}
	}
	public void SL2(int Reducer){
		SpidersLeft2+= Reducer;
		if (SpidersLeft2 <= 0) {
			SpidersLeft2 = 0;
			Instantiate();
		}
		if (SpidersLeft2 > 0) {
			Instantiate(firstKey);
		}
	}
	void OnGUI()
	{
		SpidersLeft = SpidersLeft1 + SpidersLeft2;
		GUI.Label(new Rect (300,50,400,30),"Enemies Remaining : " + SpidersLeft);
	}
}

Update() runs every frame - there’s nothing in your code that indicates you shouldn’t spawn a spider every frame, so you’ll need to keep track of how much time has passed.

If you add variables:

public float timeSpawnInterval = 3.0f;
private float timeSinceSpawn = 0.0f;

and change your Start() and Update() functions as follows:

void Start() {
  // start spawning immediately -- otherwise, 3.0 second delay
  timeSinceSpawn = timeSpawnInterval;
}

void Update(){
  timeSinceSpawn += Time.deltaTime;
  if (timeSinceSpawn > timeSpawnInterval) {
    // reset time
    timeSinceSpawn = 0.0f;

    // spawn
    SL1(0);
    SL2(0);
  }
}

Then every frame, you’ll update the time since you last have spawned a spider, and if enough time has passed, you’ll run your spawning functions.