Example #1
0
    void Awake()
    {
        chunkMeshFilter   = gameObject.GetComponent <MeshFilter>();
        chunkMeshRenderer = GetComponent <MeshRenderer>();
        chunkMeshCollider = gameObject.GetComponent <MeshCollider>();

        chunkMeshFilter.mesh         = chunkMesh = new Mesh();
        chunkMeshCollider.sharedMesh = chunkMesh;

        chunkMesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32;

        ChunkBounds = new Bounds(ChunkPosition, ChunkSize);

        WorldChunks.Add(ChunkVectors.CreateChunkIndex(ChunkPosition), this);

        ChunkIndex = ChunkVectors.CreateChunkIndex(ChunkPosition);
    }
Example #2
0
 void OnDestroy()
 {
     WorldChunks.Remove(ChunkVectors.CreateChunkIndex(ChunkPosition));
 }