Question by 
               jaozingames · Oct 13, 2020 at 05:46 PM · 
                c#errorcodepage  
              
 
              unity don't recognise the elements (0, 1, 2 etc...) what can i do ?
public class WorldGenerator : MonoBehaviour { public GameObject player;
 public int sizeX;
 public int sizeZ;
 public int groundHeight;
 public float terDetail;
 public float terHeight;
 int seed;
 public GameObject[] blocks;
 // Start is called before the first frame update
 void Start()
 {
     seed = Random.Range(100000, 999999);
     GenerateTerrain();
 }
 // Update is called once per frame
 void Update()
 {
     
 }
 void GenerateTerrain()
 {
     for (int x = 0; x < sizeX; x++)
     {
         for (int z = 0; z < sizeZ; z++)
         {
             int maxY = (int)(Mathf.PerlinNoise((x / 2 + seed) / terDetail, (z / 2 + seed) / terDetail) * terHeight);
             maxY += groundHeight;
             GameObject Grass = Instantiate(blocks[0], new Vector3(x, maxY, z), Quaternion.identity)as GameObject;
             Grass.transform.SetParent(GameObject.FindGameObjectWithTag("Environment").transform);
             for (int y = 0; y < maxY; y++)
             {
                 GameObject stone = Instantiate(blocks[1], new Vector3(x, y, z), Quaternion.identity) as GameObject;
                 stone.transform.SetParent(GameObject.FindGameObjectWithTag("Environment").transform);
             }
                 if (x == (int)(sizeX / 2) && z == (int)(sizeZ / 2))
             {
                 Instantiate(player, new Vector3(x, maxY + 3, z), Quaternion.identity);
             }
         }
     }
 }
}
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
ArgumentOutOfRange: Argument is out of range Parameter name: index 0 Answers
error CS0201 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                