void Awake() { levelUI.text += level; brickSpawner = GetComponent <SpawnBricks>(); if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } //Ensureds this gameObject is not destropyed when loading a scene DontDestroyOnLoad(gameObject); brickSpawner.LoadLevel(level, start); }
static void SpawnBricks(MenuCommand command) { SpawnBricks body = (SpawnBricks)command.context; body.PlaceBricks(false); }