Skip to content

Commit 6067db0

Browse files
belgaardEvergreen
authored andcommitted
Not disposing APV stuff when the Lighting window closes and a bake is running
The purpose of this PR is to avoid a memory leak and null pointer references when the Lighting window closes while APV is baking
1 parent 4636bbe commit 6067db0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeLightingTab.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,10 @@ public override void OnDisable()
206206

207207
EditorSceneManager.sceneOpened -= OnSceneOpened;
208208

209-
AdaptiveProbeVolumes.Dispose();
209+
// We keep allocated acceleration structures while the Lighting window is open in order to make subsequent bakes faster, but when the window closes we dispose of them
210+
// Unless a bake is running, in which case we leave disposing to CleanBakeData()
211+
if (!AdaptiveProbeVolumes.isRunning && !Lightmapping.isRunning)
212+
AdaptiveProbeVolumes.Dispose();
210213
}
211214

212215
#region On GUI

0 commit comments

Comments
 (0)