protected override void OnDestroy() { _renderGroup.Dispose(); foreach (var kvp in _meshById) { UnityEngine.Object.Destroy(kvp.Value.Mesh); } }
private void OnDestroy() { if (m_initialized) { m_BatchRendererGroup.RemoveBatch(m_batchID); if (m_material) { m_BatchRendererGroup.UnregisterMaterial(m_materialID); } if (m_mesh) { m_BatchRendererGroup.UnregisterMesh(m_meshID); } m_BatchRendererGroup.Dispose(); m_GPUPersistentInstanceData.Dispose(); m_sysmemBuffer.Dispose(); } }
private void OnDestroy() { if (m_initialized) { // NOTE: Don't need to remove batch or unregister BatchRendererGroup resources. BRG.Dispose takes care of that. m_BatchRendererGroup.Dispose(); m_GPUPersistentInstanceData.Dispose(); m_renderers.Dispose(); m_batchHash.Dispose(); m_rangeHash.Dispose(); m_drawBatches.Dispose(); m_drawRanges.Dispose(); m_instances.Dispose(); m_instanceIndices.Dispose(); m_drawIndices.Dispose(); #if UNITY_EDITOR DestroyImmediate(m_pickingMaterial); #endif } }
void OnDisable() { _brg.Dispose(); }
private void OnDisable() { batchIndexes.Clear(); batchRendererGroup.Dispose(); }
// We need to dispose our GraphicsBuffer and BatchRendererGroup when our script is no longer used, // to avoid leaking anything. Registered Meshes and Materials, and any batches added to the // BatchRendererGroup are automatically disposed when disposing the BatchRendererGroup. private void OnDisable() { m_InstanceData.Dispose(); m_BRG.Dispose(); }