From 9c29a83af702734f60885115eae6ad1f9182ee8c Mon Sep 17 00:00:00 2001 From: Gregory Labute Date: Mon, 13 May 2024 11:32:58 -0400 Subject: [PATCH] Don't allow single object upgrade from prefab editor --- .../Editor/Upgrader/CinemachineUpgradeManager.cs | 2 +- .../Editor/Upgrader/UpgradeManagerInspectorHelpers.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/com.unity.cinemachine/Editor/Upgrader/CinemachineUpgradeManager.cs b/com.unity.cinemachine/Editor/Upgrader/CinemachineUpgradeManager.cs index 80f04754f..bea6599fb 100644 --- a/com.unity.cinemachine/Editor/Upgrader/CinemachineUpgradeManager.cs +++ b/com.unity.cinemachine/Editor/Upgrader/CinemachineUpgradeManager.cs @@ -178,7 +178,7 @@ public static bool ObjectsUsePrefabs(UnityEngine.Object[] objects) if (b != null) go = b.gameObject; } - if (go != null && PrefabUtility.IsPartOfAnyPrefab(go)) + if (go != null && (PrefabUtility.IsPartOfPrefabInstance(go) || PrefabStageUtility.GetCurrentPrefabStage() != null)) return true; } return false; diff --git a/com.unity.cinemachine/Editor/Upgrader/UpgradeManagerInspectorHelpers.cs b/com.unity.cinemachine/Editor/Upgrader/UpgradeManagerInspectorHelpers.cs index d13e8fe80..0cbe04920 100644 --- a/com.unity.cinemachine/Editor/Upgrader/UpgradeManagerInspectorHelpers.cs +++ b/com.unity.cinemachine/Editor/Upgrader/UpgradeManagerInspectorHelpers.cs @@ -75,7 +75,7 @@ public override void OnOpen() ux.AddChild(new TextElement() { text = "Unity can upgrade the objects currently being inspected, but only if none of them " - + "are prefab instances. Undo is supported for this operation.", + + "are prefabs or prefab instances. Undo is supported for this operation.", style = { marginLeft = 10, marginRight = 10, marginTop = 10, marginBottom = 10, alignSelf = Align.Center } }); var text = "Upgrade this object to " + ClassName; @@ -94,7 +94,7 @@ public override void OnOpen() ux.AddChild(new TextElement() { text = "Unity can upgrade all the Cinemachine objects in the current scene, but only if none of them " - + "are prefab instances. Undo is supported for this operation.", + + "are prefabs or prefab instances. Undo is supported for this operation.", style = { marginLeft = 10, marginRight = 10, marginTop = 20, marginBottom = 10, alignSelf = Align.Center } }); ux.AddChild(new Button(() =>