not working code(help) I want it to randomly spawn my prefabs continuously ( I have 4 of them)

using UnityEngine;
using System.Collections;

public class SpawnController : MonoBehaviour
{
    public GameObject[] SquarePrefab;
    public int Prefab;
    

    void Start()
    {
        StartCoroutine(SquareSpawn());

        int Prefab = Random.Range(0,4);
    }

    IEnumerator SquareSpawn()
    {
        while (true) 
        {
            Instantiate(SquarePrefab[Prefab],transform.position,Quaternion.identity);
            yield return new WaitForSeconds(1);
        }
    }

}

You set your Prefab int at Start, which only runs once. So that int will remain the same forever. What you probably want is to change it right before you instantiate a prefab:

IEnumerator SquareSpawn()
 {
     while (true) 
     {
         int Prefab = Random.Range(0,4);
         Instantiate(SquarePrefab[Prefab],transform.position,Quaternion.identity);
         yield return new WaitForSeconds(1);
     }
 }

Also, the int Prefab in Start hides the public int Prefab in your class. You actually don’t need the public one; just delete it.