// Use this for initialization IEnumerator GenerateAll() { int count = 0; for (int z = 20; z < 20 + range; z++) { for (int x = 20; x < 20 + range; x++) { for (int y = 0; y < height; y++) { yield return(new WaitForEndOfFrame()); count++; if (count >= blockIds.Count) { count = 0; } gridManagement.LayBlock(blockIds[count], new Vector2Int(x, z)); } } } yield return(null); }