Character Lives?

I’m making a 2.5D game, like Mario. I want to give my character lives. How? All answers appreciated.

The easiest way is to simple have a “lives” variable on your player character.

Put this at the top of his script:

var lives : int;

Set the value of this in the editor (to something like 3).

Then, each time he dies, do something like this:

lives -= 1;
if ( lives > 0 )
    // Respawn the character
    // Game over! Quit the level or something

You will, of course, have to decide what actually happens during the Respawn and Game Over scenarios, but this will make it choose the right scenario depending on how many lives the player has.

There are lots of cheap plugins out there that will help integrate lives in your game very easily. I recommend “Life System Pro - Easy Lives Integration for Freemium Games” found here Unity Asset Store - The Best Assets for Game Making