void OnDestroy() { HxVolumetricCamera.AllDensityVolumes.Remove(this); if (DensityOctree != null) { DensityOctree.Remove(this); DensityOctree = null; } }
// Use this for initialization void OnEnable() { CalculateBounds(); if (DensityOctree == null) { DensityOctree = new HxOctree <HxDensityVolume>(); } HxVolumetricCamera.AllDensityVolumes.Add(this); octreeNode = DensityOctree.Add(this, minBounds, maxBounds); }