void Awake() { theobj = GameObject.Find("GameManager"); tileMeshScript = theobj.GetComponent <TileMeshScript>(); //box collider boxCollider = this.GetComponent <BoxCollider2D>(); colliderX = 13.25f; colliderY = 10f; }
private void Awake() { //Check if instance already exists if (_instance == null) { //if not, set instance to this _instance = this; } //If instance already exists and it's not this: else if (_instance != this) { //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager. Destroy(gameObject); } squareSize = MenuScript.mapSize; mapType = MenuScript.mapType; DontDestroyOnLoad(this); }