Skip to content

Instantly share code, notes, and snippets.

@jcordeiro67
Last active December 14, 2016 19:27
Show Gist options
  • Select an option

  • Save jcordeiro67/34bfe5472bff6554c2c9b1237b4c3487 to your computer and use it in GitHub Desktop.

Select an option

Save jcordeiro67/34bfe5472bff6554c2c9b1237b4c3487 to your computer and use it in GitHub Desktop.
LevelManager script reference using private instead of public
using UnityEngine;
using System.Collections;
public class LooseLevel : MonoBehaviour {
private LevelManager levelManager;
void Start () {
setInitialReferences ();
//Debug.Log (levelManager.name);
}
void OnTriggerEnter2D(Collider2D col){
//print ("Ball has entered the Loose trigger " + col.name);
levelManager.LoadLevel ("Win");
}
void setInitialReferences(){
levelManager = GameObject.Find ("LevelManager").GetComponent <LevelManager> ();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment