Skip to content

Commit

Permalink
improve the last commit - we don't want object upgrades happening fro…
Browse files Browse the repository at this point in the history
…m prefab inspectors
  • Loading branch information
glabute committed May 13, 2024
1 parent 9c29a83 commit 7c09510
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public static bool ObjectsUsePrefabs(UnityEngine.Object[] objects)
if (b != null)
go = b.gameObject;
}
if (go != null && (PrefabUtility.IsPartOfPrefabInstance(go) || PrefabStageUtility.GetCurrentPrefabStage() != null))
if (go != null && PrefabUtility.IsPartOfPrefabInstance(go) || PrefabUtility.IsPartOfPrefabAsset(go))
return true;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using UnityEditor;
using System;
using UnityEngine.UIElements;
using UnityEditor.SceneManagement;

namespace Unity.Cinemachine.Editor
{
Expand Down Expand Up @@ -88,7 +89,7 @@ public override void OnOpen()
}) {
text = text,
style = { flexGrow = 0, alignSelf = Align.Center }
}).SetEnabled(!CinemachineUpgradeManager.ObjectsUsePrefabs(Editor.targets));
}).SetEnabled(PrefabStageUtility.GetCurrentPrefabStage() == null && !CinemachineUpgradeManager.ObjectsUsePrefabs(Editor.targets));

// Upgrade current scene
ux.AddChild(new TextElement()
Expand All @@ -105,7 +106,7 @@ public override void OnOpen()
}) {
text = "Upgrade all objects in Scene",
style = { flexGrow = 0, alignSelf = Align.Center }
}).SetEnabled(!CinemachineUpgradeManager.CurrentSceneUsesPrefabs());
}).SetEnabled(PrefabStageUtility.GetCurrentPrefabStage() == null && !CinemachineUpgradeManager.CurrentSceneUsesPrefabs());

// Upgrade project
ux.AddChild(new TextElement()
Expand Down

0 comments on commit 7c09510

Please sign in to comment.