protected override void OnDestroy()
        {
            if (UniqueSharedMeshData != null)
            {
                UniqueSharedMeshData.Clear();
            }

            if (MeshHashToInstanceCount.IsCreated)
            {
                MeshHashToInstanceCount.Dispose();
            }

            if (MeshHashToSkinMatrixIndex.IsCreated)
            {
                MeshHashToSkinMatrixIndex.Dispose();
            }

#if ENABLE_COMPUTE_DEFORMATIONS
            if (MeshHashToSharedBuffer.IsCreated)
            {
                MeshHashToSharedBuffer.Dispose();
            }

            if (MeshHashToDeformedMeshIndex.IsCreated)
            {
                MeshHashToDeformedMeshIndex.Dispose();
            }

            if (MeshHashToBlendWeightIndex.IsCreated)
            {
                MeshHashToBlendWeightIndex.Dispose();
            }

            if (m_MeshHashToRenderMesh != null)
            {
                m_MeshHashToRenderMesh.Clear();
            }

            if (MeshBufferManager != null)
            {
                MeshBufferManager.OnDestroy();
            }

            if (BlendShapeBufferManager != null)
            {
                BlendShapeBufferManager.OnDestroy();
            }
#endif
            if (SkinningBufferManager != null)
            {
                SkinningBufferManager.OnDestroy();
            }
        }
        protected override void OnCreate()
        {
#if ENABLE_COMPUTE_DEFORMATIONS
            if (!UnityEngine.SystemInfo.supportsComputeShaders)
            {
                UnityEngine.Debug.LogWarning("Warning: Current platform does not support compute shaders. Compute shaders are required for Compute Deformations. Compute Deformation systems will be disabled.");
                Enabled = false;
                return;
            }
#endif

            m_RemovedMeshQuery = GetEntityQuery(
                ComponentType.ReadOnly <SharedMeshData>(),
                ComponentType.Exclude <RenderMesh>(),
                ComponentType.Exclude <DeformedEntity>()
                );

            m_AddedMeshQuery = GetEntityQuery(
                ComponentType.ReadOnly <RenderMesh>(),
                ComponentType.ReadOnly <DeformedEntity>(),
                ComponentType.Exclude <SharedMeshData>()
                );

            var query = new EntityQueryDesc
            {
                All = new ComponentType[] {
#if ENABLE_COMPUTE_DEFORMATIONS
                    typeof(DeformedMeshIndex),
#endif
                    ComponentType.ReadOnly <RenderMesh>(),
                    ComponentType.ReadOnly <SharedMeshData>()
                },
                Any = new ComponentType[] {
#if ENABLE_COMPUTE_DEFORMATIONS
                    typeof(BlendWeightBufferIndex),
#endif
                    typeof(SkinMatrixBufferIndex)
                }
            };

            m_BufferIndexQuery = GetEntityQuery(query);

            m_ResizeBuffersSystem        = World.GetOrCreateSystem <ResizeBuffersSystem>();
            m_ResizeBuffersSystem.Parent = this;

#if ENABLE_COMPUTE_DEFORMATIONS
            m_PushSharedMeshDataSystem        = World.GetOrCreateSystem <PushSharedMeshDataSystem>();
            m_PushSharedMeshDataSystem.Parent = this;

            MeshHashToSharedBuffer      = new NativeHashMap <int, SharedMeshBufferIndex>(64, Allocator.Persistent);
            MeshHashToDeformedMeshIndex = new NativeHashMap <int, uint>(64, Allocator.Persistent);
            MeshHashToBlendWeightIndex  = new NativeHashMap <int, int>(64, Allocator.Persistent);
            m_MeshHashToRenderMesh      = new Dictionary <int, RenderMesh>(64);

            MeshBufferManager = new MeshBufferManager();
            MeshBufferManager.OnCreate();

            BlendShapeBufferManager = new BlendShapeBufferManager();
            BlendShapeBufferManager.OnCreate();

            m_RebuildSharedMeshBuffers = true;
#endif
            MeshHashToInstanceCount   = new NativeHashMap <int, int>(64, Allocator.Persistent);
            MeshHashToSkinMatrixIndex = new NativeHashMap <int, int>(64, Allocator.Persistent);

            UniqueSharedMeshData = new List <SharedMeshData>();

            SkinningBufferManager = new SkinningBufferManager();
            SkinningBufferManager.OnCreate();

            m_RebuildDeformedMeshBuffers = true;
        }