private void Awake() { if (!instance) { instance = this; } else { Destroy(gameObject); } Assert.IsNotNull(groundTileMap, "No ground tilemap found!"); Assert.IsNotNull(ApplePrefab, "No food prefab found!"); GameObject tileMapObject = GameObject.Find("GroundTilemap"); tileMap = tileMapObject.GetComponent <TileMapScript>(); GameObject snakeObject = GameObject.Find("Snake"); snake = snakeObject.GetComponent <Snake>(); SpawnFood(); GameObject foodObject = GameObject.Find("ApplePrefab(Clone)"); food = foodObject.GetComponent <FoodScript>(); if (scoreEvent == null) { scoreEvent = new GameModeEvent(); } }