Spawn the animals at timed intervals

public class Spwan : MonoBehaviour
{
public GameObject AnimalPrefebs;
public float SpawnSitX= 20;
public float SpawnSitZ = 30;
public float startDelay = 2F;
public float spawnInterval = 1F;

// Start is called before the first frame update
void Start()
{

    {
        InvokeRepeating("SpawnRandomAnimal",startDelay,spawnInterval);
    }

    void SpawnRandomAnimal()
    {

        int AnimalIndex = Random.Range(0, AnimalPrefebs.Length);

        Vector3 SpwanPos = new Vector3(Random.Range(-SpawnSitX, SpawnSitX), 0, SpawnSitZ);

        Instantiate(AnimalPrefebs[AnimalIndex], SpwanPos, AnimalPrefebs[AnimalIndex].transform.rotation);
    }

}

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

}

}

using UnityEngine;
public class Spawn : MonoBehaviour
{
public GameObject[] AnimalPrefebs;
public float SpawnSitX= 20;
public float SpawnSitZ = 30;
public float startDelay = 2F;
public float spawnInterval = 1F;

    void Start()
    {
        InvokeRepeating("SpawnRandomAnimal",startDelay,spawnInterval);
    }

    void SpawnRandomAnimal()
    {
        int AnimalIndex = Random.Range(0, AnimalPrefebs.Length);

        Vector3 SpwanPos = new Vector3(Random.Range(-SpawnSitX, SpawnSitX), 0, SpawnSitZ);

        Instantiate(AnimalPrefebs[AnimalIndex], SpwanPos, AnimalPrefebs[AnimalIndex].transform.rotation);
    }
}

thankyou so much,it;s work.But i cant denify where is the different.

OPPS!!.I ADD MORE {}.that why the problem is . thanksa lot

The indentation will show you the hierarchy of your methods, you can spot added or missing { } based on that. Be sure to format the document often, I have auto-format on save enabled.