Search Unity

QuickVolume does not get destroyed upon exiting play mode

Discussion in 'Image Effects' started by lasercannon, May 4, 2019.

  1. lasercannon

    lasercannon

    Joined:
    Nov 29, 2012
    Posts:
    80
    Hey there!

    It looks like any QuickVolume calls I create in play mode are not cleaned up if I exit play mode. This means that subsequent playthroughs have the post volume stuck there.

    For context, we don't have an OnDestroy method to put this in, since this is getting called from our custom designer-driven tool, where it's on the designer to initiate a clean up of whichever QuickVolumes they create, and it's not tied to a specific GameObject or MonoBehaviour. If we quit play mode before the designer has called the cleanup method, it gets stuck.

    Right now I'm getting around by adding this line after each QuickVolume call. This means that the object shows up in the hierarchy, which is... totally fine, actually... and allows me to debug quick volumes. Perhaps this would be good functionality for QuickVolumes made during play mode?

    Code (CSharp):
    1. volume.gameObject.hideFlags = HideFlags.None;
    The only other way I can think of is having an OnApplicationQuit behavior that clears these out, which is a little odd. I would expect that, even if we fail to cleanup a QuickVolume under normal circumstances, it still wouldn't stick around after play mode.

    Is this an issue with HideFlags itself? Or is this intended functionality?