From facd2ce1e92f794bd069ec519445c31115f5849c Mon Sep 17 00:00:00 2001 From: talessampaio-kazoo Date: Tue, 15 Feb 2022 13:47:45 -0300 Subject: [PATCH] Fix PrefabStageUtility not experimental after 2021.2 --- Scripts/BakingCamera.cs | 4 ++++ Scripts/Editor/UIParticleEditor.cs | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Scripts/BakingCamera.cs b/Scripts/BakingCamera.cs index 3d8659d..14fd611 100644 --- a/Scripts/BakingCamera.cs +++ b/Scripts/BakingCamera.cs @@ -17,7 +17,11 @@ namespace Coffee.UIParticleExtensions get { // If current scene is prefab mode, create OverlayCamera for editor. +#if UNITY_2021_2_OR_NEWER + var prefabStage = UnityEditor.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage(); +#else var prefabStage = UnityEditor.Experimental.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage(); +#endif if (prefabStage == null || !prefabStage.scene.isLoaded) return null; if (s_InstanceForPrefab) return s_InstanceForPrefab; diff --git a/Scripts/Editor/UIParticleEditor.cs b/Scripts/Editor/UIParticleEditor.cs index 2187460..21f2d83 100644 --- a/Scripts/Editor/UIParticleEditor.cs +++ b/Scripts/Editor/UIParticleEditor.cs @@ -212,8 +212,12 @@ namespace Coffee.UIExtensions DestroyImmediate(p); DestroyImmediate(cr); -#if UNITY_2018_3_OR_NEWER +#if UNITY_2021_2_OR_NEWER + var stage = UnityEditor.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage(); +#elif UNITY_2018_3_OR_NEWER var stage = UnityEditor.Experimental.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage(); +#endif +#if UNITY_2018_3_OR_NEWER if (stage != null && stage.scene.isLoaded) { #if UNITY_2020_1_OR_NEWER