public void Generate(int opt) { option = opt; //option = 0, generate Wall Maze //option = 1, generate Tall Maze finished = false; fm = GameObject.Find("GameManager").GetComponent <FloorManager>(); if (option == 0) { fm.AllWallFloor(); } else if (option == 1) { fm.AllTallFloor(h); } floorObjects = fm.floorObjects; //starting pos needs to be even int startX = Random.Range(0, fm.floor.GetLength(0) / 2) * 2; int startY = Random.Range(0, fm.floor.GetLength(1) / 2) * 2; past = new List <Coord>(); CarvePath(startX, startY); finished = true; }