- Home /
Question by
warpmaster7 · Sep 27, 2014 at 04:43 PM ·
buttonslivesgame over
Click a button, lose a life
I wanted to make a script where if I click a certain button then I lose a life. There would be 3 lives. Also when I run out of lives I want to load another level with a game over screen. Can anyone help me out?
Comment
this script for pc & web :
1- attach this script to your button.
using UnityEngine; using System.Collections;
public class Example : $$anonymous$$onoBehaviour { public int life = 3;
On$$anonymous$$ouseDown() { life -=1; if(life == 0) { application.loadlevel(just add the number of your game over scene her) } } }