From 7b37a0fba1e817994a65b1f2f7c02ccfc1c6bea6 Mon Sep 17 00:00:00 2001 From: Nico de Poel Date: Wed, 26 Jun 2024 11:45:41 +0200 Subject: [PATCH] Correctly destroy resources when not in play mode --- .../PostProcessing/Runtime/FSR3/Fsr3UpscalerResources.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerResources.cs b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerResources.cs index 676867b..344a371 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerResources.cs +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerResources.cs @@ -207,7 +207,14 @@ namespace FidelityFX if (resource == null) return; +#if UNITY_EDITOR + if (Application.isPlaying && !UnityEditor.EditorApplication.isPaused) + UnityEngine.Object.Destroy(resource); + else + UnityEngine.Object.DestroyImmediate(resource); +#else UnityEngine.Object.Destroy(resource); +#endif resource = null; }