From 05b923881f94e52bde7914099938e9d76a6e153d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=8C=80=EC=9B=90?= Date: Sat, 12 Jan 2019 20:20:58 +0900 Subject: [PATCH] Prevent OverlayCamera creation if current scene is prefab mode. --- Assets/Coffee/UIExtensions/UIParticle/UIParticle.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Assets/Coffee/UIExtensions/UIParticle/UIParticle.cs b/Assets/Coffee/UIExtensions/UIParticle/UIParticle.cs index e9b3321..25db5a6 100755 --- a/Assets/Coffee/UIExtensions/UIParticle/UIParticle.cs +++ b/Assets/Coffee/UIExtensions/UIParticle/UIParticle.cs @@ -299,6 +299,14 @@ namespace Coffee.UIExtensions if (0 < m_ParticleSystem.particleCount) { Profiler.BeginSample ("Bake Mesh"); + + // If current scene is prefab mode, prevent create OverlayCamera. + #if UNITY_2018_3_OR_NEWER && UNITY_EDITOR + var prefabStage = UnityEditor.Experimental.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage(); + if (prefabStage != null && prefabStage.scene != null && prefabStage.scene.isLoaded) + return; + #endif + var cam = rootCanvas.renderMode == RenderMode.ScreenSpaceOverlay ? UIParticleOverlayCamera.GetCameraForOvrelay (rootCanvas) : canvas.worldCamera ?? Camera.main;