Skip to content

Instantly share code, notes, and snippets.

@pmarinr
Created February 25, 2015 15:45
Show Gist options
  • Save pmarinr/da2c2517f70454bf814e to your computer and use it in GitHub Desktop.
Save pmarinr/da2c2517f70454bf814e to your computer and use it in GitHub Desktop.
Sistema de variables globales
using UnityEngine;
using System.Collections;
public class GameControl : MonoBehaviour {
public int puntuacion = 0;
public int vidas = 3;
public static GameControl gamecontrol;
void Awake(){
if (gamecontrol == null) {
gamecontrol = this;
DontDestroyOnLoad (gameObject);
} else if (gamecontrol != this) {
Destroy (this);
}
}
public void Level2(){
Application.LoadLevel ("escena2");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment