Skip to content

Commit 81d13f5

Browse files
authored
Merge pull request #84 from Unity-Technologies/uni-23221-fbxprefab-in-scene
uni-23221 make the FbxPrefab not be editable when it can't work.
2 parents 80e99ec + eaac75a commit 81d13f5

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Assets/FbxExporters/Editor/FbxPrefabInspector.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,16 @@ public class FbxPrefabInspector : UnityEditor.Editor {
88
public override void OnInspectorGUI() {
99
FbxPrefab fbxPrefab = (FbxPrefab)target;
1010

11+
// We can only change these settings when applied to a prefab.
12+
bool isDisabled = AssetDatabase.GetAssetPath(fbxPrefab) == "";
13+
if (isDisabled) {
14+
EditorGUILayout.HelpBox("Please select a prefab. You can't edit an instance in the scene.",
15+
MessageType.Info);
16+
}
17+
EditorGUI.BeginDisabledGroup(isDisabled);
18+
1119
fbxPrefab.SetAutoUpdate(EditorGUILayout.Toggle ("Auto-update:", fbxPrefab.WantsAutoUpdate()));
12-
if (!fbxPrefab.WantsAutoUpdate()) {
20+
if (!isDisabled && !fbxPrefab.WantsAutoUpdate()) {
1321
if (GUILayout.Button("Sync prefab to FBX")) {
1422
fbxPrefab.SyncPrefab();
1523
}
@@ -30,6 +38,8 @@ public override void OnInspectorGUI() {
3038
EditorGUILayout.SelectableLabel(fbxPrefab.GetFbxHistory().ToJson());
3139
GUILayout.EndHorizontal();
3240
#endif
41+
42+
EditorGUI.EndDisabledGroup();
3343
}
3444
}
3545
}

0 commit comments

Comments
 (0)