if others are dead, do this

Hi, again :slight_smile:
I’m trying make it so that when a character falls off the edge and collides with my fallour floor - He’s classed as dead, and lets say in a four player game, when the 3 other opponents are dead, the 1 alive player (dead=false) wins.

What I’m asking for is there a way to check if 3 of my 4 charaters are dead, and if so, to open up a winscreen or gui depending on winner “Player 1 wins”.

private var dead = false;

function OnTriggerEnter (other : Collider) 
		dead = true;       

Thank you so, so much :slight_smile:

If you have a list of your players gameobjects somewhere, make the dead-variable public and loop through the players to check how many of them is dead.

var deadPlayers : int = 0;
for(int i=0; i<_players.Length; i++){
    if (_players*.dead)*


if (deadPlayers >= 3)