Parsing Error

Website Link:

My error:
Assets/Scripts/World.cs(41,15): error CS8025: Parsing error

My Code

using UnityEngine;
using System.Collections;

public class World : MonoBehaviour {

	public GameObject chunk;
	public GameObject[,,] chunks;
	public int chunkSize=16;

	public byte[,,] data;
	public int worldX=16;
	public int worldY=16;
	public int worldZ=16;


	// Use this for initialization
	void Start () {

		data = new byte[worldX, worldY, worldZ];

		for (int x=0; x<worldX; x++){
			for (int z=0; z<worldZ; z++){
				int stone=PerlinNoise(x,0,z,10,3,1.2f);
				stone+= PerlinNoise(x,300,z,20,4,0)+10;
				int dirt=PerlinNoise(x,100,z,50,2,0) +1;
				
				for (int y=0; y<worldY; y++){
					if(y<=stone){
						data[x,y,z]=1;
					} else if(y<=dirt+stone){
						data[x,y,z]=2;
					}
					
				}
			}
		}
		}
	
	}

	chunks=new GameObject[Mathf.FloorToInt(worldX/chunkSize),
	                      Mathf.FloorToInt(worldY/chunkSize),
	                      Mathf.FloorToInt(worldZ/chunkSize)};

	                      for (int x=0; x<chunks.GetLenght(0); x++){
		for(int y=0; y<chunks.GetLenght(1); y++){
			for (internal z=0; z<chunks(2); z++){

				chunks[x,y,z]= Instantiate(chunk,
				                           new Vector3(x*chunkSize,y*chunkSize,z*chunkSize),
				                           new Quaternion(0,0,0,0)) as GameObject;

				Chunk newChunkScript= chunks[x,y,z].GetComponent(/"Chunk"/) as Chunk;

				newChunkScript.worldGO=gameObject;
				newChunkScript.chunkSize=chunkSize;
				newChunkScript.chunkX=x*chunkSize;
				newChunkScript.chunkY=y*chunkSize;
				newChunkScript.chunkZ=z*chunkSize;

			}
		}
	   }

	                      int PerlinNoise(int x,int y,int z, float scale, float height, float power){
		float rValue;
		rValue=Noise.GetNoise ((double)x) / scale, ((double)y)/ scale, ((double)z) / scale);
		rValue*=height;
		
		if(power!=0){
			rValue=Mathf.Pow( rValue, power);
		}
		
		return (int) rValue;
	                      }
	
	// Update is called once per frame
	void Update () {

		public byte Block(int Matrix4x4, int yield, int z){
			if (x >= worldX || x < 0 || y >= worldY || y < 0 || z >= worldZ || z < 0) {
				return (byte) 1;
			}
			
			return data [x, y, z];
		}

		 
	
	}
}

Thanks in advance. :slight_smile:

You ended with the wrong bracket at line 43. You used } rather than ].

I fixed it. The error is still here:

Assets/Scripts/World.cs(41,15): error CS8025: Parsing error

using UnityEngine;
using System.Collections;

public class World : MonoBehaviour {

	public GameObject chunk;
	public GameObject[,,] chunks;
	public int chunkSize=16;

	public byte[,,] data;
	public int worldX=16;
	public int worldY=16;
	public int worldZ=16;


	// Use this for initialization
	void Start () {

		data = new byte[worldX, worldY, worldZ];

		for (int x=0; x<worldX; x++){
			for (int z=0; z<worldZ; z++){
				int stone=PerlinNoise(x,0,z,10,3,1.2f);
				stone+= PerlinNoise(x,300,z,20,4,0)+10;
				int dirt=PerlinNoise(x,100,z,50,2,0) +1;
				
				for (int y=0; y<worldY; y++){
					if(y<=stone){
						data[x,y,z]=1;
					} else if(y<=dirt+stone){
						data[x,y,z]=2;
					}
					
				}
			}
		}
		}
	
	}

	chunks=new GameObject[Mathf.FloorToInt(worldX/chunkSize),
	                      Mathf.FloorToInt(worldY/chunkSize),
	                      Mathf.FloorToInt(worldZ/chunkSize)];

	                      for (int x=0; x<chunks.GetLength(0); x++){
		for(int y=0; y<chunks.GetLength(1); y++){
			for (internal z=0; z<chunks(2); z++){

				chunks[x,y,z]= Instantiate(chunk,
				                           new Vector3(x*chunkSize,y*chunkSize,z*chunkSize),
				                           new Quaternion(0,0,0,0)) as GameObject;

				Chunk newChunkScript= chunks[x,y,z].GetComponent(/"Chunk"/) as Chunk;

				newChunkScript.worldGO=gameObject;
				newChunkScript.chunkSize=chunkSize;
				newChunkScript.chunkX=x*chunkSize;
				newChunkScript.chunkY=y*chunkSize;
				newChunkScript.chunkZ=z*chunkSize;

			}
		}
	   }

	                      int PerlinNoise(int x,int y,int z, float scale, float height, float power){
		float rValue;
		rValue=Noise.GetNoise ((double)x) / scale, ((double)y)/ scale, ((double)z) / scale);
		rValue*=height;
		
		if(power!=0){
			rValue=Mathf.Pow( rValue, power);
		}
		
		return (int) rValue;
	                      }
	
	// Update is called once per frame
	void Update () {

		public byte Block(int Matrix4x4, int yield, int z){
			if (x >= worldX || x < 0 || y >= worldY || y < 0 || z >= worldZ || z < 0) {
				return (byte) 1;
			}
			
			return data [x, y, z];
		}

		 
	
	}
}

line 39, remove }. and 37 if your continuing the script. If you’re using windows, mono keeps track of which { } are linked. Same with ( ).

Edit: A little advice, don’t copy and paste. The mess you have is a result of that and you don’t actually learn anything. If you type it, even if it means flipping back and forth, you can actually read the script as you type and see what’s actually happening and what it’s doing.