How can I end a game when a certain number of zombies are killed?

My question might be silly but iam new to unity and I’m making a zombie survival game and I want game over scene to load when some amount of zombies are killed.

Give these a shot
https://unity3d.com/learn/tutorials

Can’t really be of much help without knowing a bit about your game but I’ll try.

public class GameOver  {

public int leftToSpawn;

private void Awake ()
{
leftToSpawn = 10; //Your desired number of enemies here
}

public void EnemyKilled () //Call this function whenever an enemy dies
leftToSpawn--;
if (leftToSpawn <=0)
{
//Code here to load your new scene
}
}

This is very basic but it will do what you need. It’s well worth watching the unity tutorials. I learnt very quickly that way

When the player kills a zombie, increment a kill count variable by 1 and then check if the kill count variable is greater or equal to a max kills value. If true then do whatever game win logic you plan.

You could have the player’s gameobject keep track of kills, or you could create a singleton style tracker for kills. For example, have a gameobject with the tag “KillTracker” with some kill tracking script on it. When a zombie dies, in its ondestroy method you have it do something like GameObject.FindGameObjectWithTag(“KillTracker”).GetComponent().IncrementKillCount() In that method you increment the number of total kills by the player, and check if they are high enough to win the game, if so you change to game win scene or whatever.