private void Awake() { callbacksCount = 0; halfSize = chunkSize * 0.5f; chunkSize = 2; voxelSize = chunkSize / voxelResolution; int chunksCount = chunkResolutionX * chunkResolutionY; chunks = new VoxelGrid[chunksCount]; cameraControler.Initialze(new Vector2(chunkResolutionX * chunkSize / 2, chunkResolutionY * chunkSize)); for (int i = 0, y = 0; y < chunkResolutionY; y++) { for (int x = 0; x < chunkResolutionX; x++, i++) { CreateChunk(i, x, y); } } BoxCollider box = gameObject.AddComponent <BoxCollider>(); box.size = new Vector3(chunkResolutionX * chunkSize, chunkResolutionY * chunkSize); box.center = new Vector3((chunkResolutionX * chunkSize) / 2, (chunkResolutionY * chunkSize) / 2, 0); InitCallback(); }