how to make endless rounds in zombie game

i need some kind of ai that makes the game endless like adds 5 zombies every round

You need a gameobject that has some sort of game manager script attached. This script will need to know how many zombies are currently active and have a “round” number. Take the “round” number and spawn zombies * 5 (so round 1 will spawn 5 zombies, round 2 will spawn 10 zombies etc). When all zombies are destroyed, +1 the round number.
Don’t hold your breath waiting for someone to write the script for you though.

As MajorParts is describing the script is very nice. I only would like to add that there is a example about how to create waves in the learning website. Maybe you can take a look at the space shooter tutorial just to see how it works there. See the spawning waves tutorial

Make a list of all zombies in a scene and store them into a variable.

List <zombie> Zombies = new List <zombie>();
int zombiesLeft = Zombies.Count;

Make sure each zombie object is tagged as a zombie.

Afterwards, add in a function like

    if (zombiesLeft == 0){
            round++;
            SpawnZombies (round * 5);
    }

assuming you have a SpawnZombies function of course.

Thats pretty much all you should need in terms of increasing their spawn rate

So, what you will need is a “Game Manager” responsible for handling the rounds and zombie spawning.

Start of by making an empty gamobject called “Game Manager”, then create and attach a script called “GameManager”. Within the script you need to define a function that handles the spawning for the zombies and round counting. Here is a quick example (this is in c#)

public GameObject zombiePrefab
public int roundCount;

void NewRound() {
    roundCount++;
    for(int i = 0; i < 5; i++) {
        Instantiate(zombiePrefab, transform.position, Quanternion.identity);
    }
}

You could extend the spawning system by placing lots of empty gameobjects around the map, called “Spawn”. Then add these lines to the script.

public Transform[] spawnPoints;

for(int i = 0; i < 5; i++) {
    Instantiate(zombiePrefab, spawnPoints[Random.Range(0, spawnPoints.Length)], Quaternion.identity);
}

You could also further extend this code to increase the amount of zombies spawned per round.

public int zombieCount;

for(int i = 0; i < zombieCount; i++)

Good luck!