private void OnEnable()
        {
            // init native containers
            blocks          = new NativeArray <BlockType>(FixedChunkSizeXZ * ChunkSizeY * FixedChunkSizeXZ, Allocator.Persistent);
            lightingData    = new NativeArray <int>(FixedChunkSizeXZ * ChunkSizeY * FixedChunkSizeXZ, Allocator.Persistent);
            biomeTypes      = new NativeArray <BiomeType>(FixedChunkSizeXZ * FixedChunkSizeXZ, Allocator.Persistent);
            blockParameters = new NativeHashMap <BlockParameter, short>(2048, Allocator.Persistent);

            blockVerticles = new NativeList <float3>(16384, Allocator.Persistent);
            blockTriangles = new NativeList <int>(32768, Allocator.Persistent);
            blockUVs       = new NativeList <float2>(16384, Allocator.Persistent);

            liquidVerticles = new NativeList <float3>(8192, Allocator.Persistent);
            liquidTriangles = new NativeList <int>(16384, Allocator.Persistent);
            liquidUVs       = new NativeList <float2>(8192, Allocator.Persistent);

            plantsVerticles = new NativeList <float3>(4096, Allocator.Persistent);
            plantsTriangles = new NativeList <int>(8192, Allocator.Persistent);
            plantsUVs       = new NativeList <float2>(4096, Allocator.Persistent);

            chunkDissapearingAnimation = GetComponent <ChunkDissapearingAnimation>();
            chunkAnimation             = GetComponent <ChunkAnimation>();

            World.TimeToBuild += BuildBlocks;
            StartCoroutine(CheckNeighbours());

            if (biomeColorsTexture == null)
            {
                biomeColorsTexture            = new Texture2D(FixedChunkSizeXZ, FixedChunkSizeXZ, TextureFormat.RGB24, true);
                biomeColorsTexture.filterMode = FilterMode.Bilinear;
                biomeColorsTexture.wrapMode   = TextureWrapMode.Clamp;
                biomeColorsTexture.Apply();
            }

            lightingBuffer = new ComputeBuffer(FixedChunkSizeXZ * ChunkSizeY * FixedChunkSizeXZ, sizeof(int), ComputeBufferType.Default);
            var mr = blockMeshFilter.GetComponent <MeshRenderer>();

            mr.material.SetBuffer("lightData", lightingBuffer);
        }
        public void Init()
        {
            if (!blocks.IsCreated)
            {
                // init native containers
                blocks          = new NativeArray <BlockType>(FixedChunkSizeXZ * ChunkSizeY * FixedChunkSizeXZ, Allocator.Persistent);
                lightingData    = new NativeArray <int>(FixedChunkSizeXZ * ChunkSizeY * FixedChunkSizeXZ, Allocator.Persistent);
                biomeTypes      = new NativeArray <BiomeType>(FixedChunkSizeXZ * FixedChunkSizeXZ, Allocator.Persistent);
                blockParameters = new NativeHashMap <BlockParameter, short>(2048, Allocator.Persistent);

                blockVerticles = new NativeList <float3>(16384, Allocator.Persistent);
                blockTriangles = new NativeList <int>(32768, Allocator.Persistent);
                blockUVs       = new NativeList <float2>(16384, Allocator.Persistent);

                liquidVerticles = new NativeList <float3>(8192, Allocator.Persistent);
                liquidTriangles = new NativeList <int>(16384, Allocator.Persistent);
                liquidUVs       = new NativeList <float2>(8192, Allocator.Persistent);

                plantsVerticles = new NativeList <float3>(4096, Allocator.Persistent);
                plantsTriangles = new NativeList <int>(8192, Allocator.Persistent);
                plantsUVs       = new NativeList <float2>(4096, Allocator.Persistent);

                chunkDissapearingAnimation = GetComponent <ChunkDissapearingAnimation>();
                chunkAnimation             = GetComponent <ChunkAnimation>();
            }

            if (lightingBuffer == null || !lightingBuffer.IsValid())
            {
                lightingBuffer = new ComputeBuffer(FixedChunkSizeXZ * ChunkSizeY * FixedChunkSizeXZ, sizeof(int), ComputeBufferType.Default);
                var mr = blockMeshFilter.GetComponent <MeshRenderer>();
                mr.material.SetBuffer("lightData", lightingBuffer);
            }

            World.TimeToBuild += BuildBlocks;
            StartCoroutine(CheckNeighbours());
        }