i have a player, when it dies the scene is reloaded. i want to limit the reload to 3 times and then show game over scene how should i code this?
Use a static
variable, one that can’t be instantiated or destroyed even when changing scenes.
public static int reloadedNum=0;
//later on
if(reloadedNum<3){
reload();
reloadedNum++;
}
else{
gameOver();
}