Need help with my #c script to Generate 2 Obstacles

This code bellow is working for the one Obstacle1 prefab
this is what happens when its working for obstacle1. obstacle1 generates off screen on right moves left then off screen then disappears and continues back to the beginning.

Im new in making games… I have this script GenerateObstacles.cs file that is working and it automatically generates Obstacle1 prefab. I’ve been trying to figure out how to add “Obstacle2” with a different float wait time.
I’ve tried to make it work. Then when i go to test run the game the screen blinks and dose nothing. Need help please and thank you.

  •       using UnityEngine;
          using System.Collections;
         
          public class GenerateObstacles : MonoBehaviour {
         
              void Start () {
                  StartCoroutine("CreateObstacle");
              }
         
              IEnumerator CreateObstacle() {
                  float waitTime = 2.5f;
                  while(true) {
                      ObjectPool.instance.GetObjectForType("Obstacle1", true);
                      yield return new WaitForSeconds(waitTime);
                  }
              }
          }
    

Thank you for the quick reply and yes I am new to C# programing. This is my ObjectPool.cs
*
using System.Collections;
using System.Collections.Generic;

public class ObjectPool : MonoBehaviour {

    public static ObjectPool instance;
    public GameObject[] objectPrefabs;
    public List<GameObject>[] pooledObjects;
    public int[] amountToBuffer;
    protected GameObject containerObject;

    void Awake() {
        instance = this;
    }

	void Start() {
        containerObject = new GameObject("ObjectPool");
        pooledObjects = new List<GameObject>[objectPrefabs.Length];
        int i = 0;
        for(int j = 0; j < objectPrefabs.Length; j++) {
            pooledObjects *= new List<GameObject>();* 

int bufferAmount = amountToBuffer*;*
for(int n = 0; n < bufferAmount; n++) {
GameObject newObj = Instantiate(objectPrefabs[j]) as GameObject;
newObj.name = objectPrefabs[j].name;
PoolObject(newObj);
}
i++;
}
* }*

* public GameObject GetObjectForType(string objectType, bool onlyPooled) {*
for(int i = 0; i < objectPrefabs.Length; i++) {
GameObject prefab = objectPrefabs*;*
if(prefab.name == objectType) {
if(pooledObjects*.Count > 0) {*
GameObject pooledObject = pooledObjects*[0];*
pooledObjects*.RemoveAt(0);*
pooledObject.transform.parent = null;
pooledObject.SetActive(true);
return pooledObject;
} else if(!onlyPooled) {
return Instantiate(objectPrefabs*) as GameObject;*
}
break;
}
}
return null;
}

public void PoolObject(GameObject obj) {
for(int i = 0; i < objectPrefabs.Length; i++) {
if(objectPrefabs*.name == obj.name) {*
obj.SetActive(false);
obj.transform.parent = containerObject.transform;
pooledObjects*.Add(obj);*
return;
}
}
}

}
*
And this is Obstacle.cs I assign to my object obstacle1 prefab.
using System.Collections;

public class Obstacle : MonoBehaviour {

public Vector3 velocity = new Vector3(-2.5f, 0);
public AudioClip sound;
private Transform cachedTransform;
private bool hasEnteredTrigger = false;

void Awake() {
cachedTransform = transform;
}

* void Update() {*
cachedTransform.Translate(velocity * Time.smoothDeltaTime);
if(!isVisible()) {
Deactivate();
}
* }*

void OnEnable() {
cachedTransform.position = new Vector3(11, Random.Range(-3.0f, 3.0f), 5);
}

void OnDisable() {
cachedTransform.position = new Vector3(-9999, 0, 5);
hasEnteredTrigger = false;
}

bool isVisible() {
bool result = true;
Vector2 screenPosition = Camera.main.WorldToScreenPoint(cachedTransform.position);
if(screenPosition.x < -100) {
result = false;
}
return result;
}

void Deactivate() {
ObjectPool.instance.PoolObject(gameObject);
}

void OnTriggerEnter2D(Collider2D other) {
if(hasEnteredTrigger == false && other != null && other.CompareTag(“Player”)) {
Score.TotalScore += 1;
AudioSource.PlayClipAtPoint(sound, new Vector3(0, 0, 0), 1.0f);
hasEnteredTrigger = true;
}
}

}

*
Thank you for your time and help…

using UnityEngine;
using System.Collections;

public class genarate : MonoBehaviour {

public GameObject rocks;

// Use this for initialization
void Start()
{
	InvokeRepeating("CreateObstacle", 1f, 1.5f);
}

void CreateObstacle()
{
	Instantiate (rocks);
}

}