fix: PrefabStageUtility class is not experimental after 2021.2

3.x
talessampaio-kazoo 2022-02-15 13:47:45 -03:00 committed by mob-sakai
parent 2e4d80bc1c
commit 0fd5d7affe
2 changed files with 9 additions and 1 deletions

View File

@ -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;

View File

@ -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