Skip to content

Commit 8ea1ccd

Browse files
author
Jiang Yin
committed
修改 Inspector 以兼容 2018.3 版本
1 parent 37b7029 commit 8ea1ccd

18 files changed

+32
-18
lines changed

Scripts/Editor/Inspector/ConfigComponentInspector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public override void OnInspectorGUI()
3939
}
4040
EditorGUI.EndDisabledGroup();
4141

42-
if (EditorApplication.isPlaying && PrefabUtility.GetPrefabType(t.gameObject) != PrefabType.Prefab)
42+
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
4343
{
4444
EditorGUILayout.LabelField("Config Count", t.ConfigCount.ToString());
4545
}

Scripts/Editor/Inspector/DataNodeComponentInspector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public override void OnInspectorGUI()
2626

2727
DataNodeComponent t = (DataNodeComponent)target;
2828

29-
if (PrefabUtility.GetPrefabType(t.gameObject) != PrefabType.Prefab)
29+
if (IsPrefabInHierarchy(t.gameObject))
3030
{
3131
DrawDataNode(t.Root);
3232
}

Scripts/Editor/Inspector/DataTableComponentInspector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public override void OnInspectorGUI()
4141
}
4242
EditorGUI.EndDisabledGroup();
4343

44-
if (EditorApplication.isPlaying && PrefabUtility.GetPrefabType(t.gameObject) != PrefabType.Prefab)
44+
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
4545
{
4646
EditorGUILayout.LabelField("Data Table Count", t.Count.ToString());
4747

Scripts/Editor/Inspector/DebuggerComponentInspector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public override void OnInspectorGUI()
2828

2929
EditorGUILayout.PropertyField(m_Skin);
3030

31-
if (EditorApplication.isPlaying && PrefabUtility.GetPrefabType(t.gameObject) != PrefabType.Prefab)
31+
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
3232
{
3333
bool activeWindow = EditorGUILayout.Toggle("Active Window", t.ActiveWindow);
3434
if (activeWindow != t.ActiveWindow)

Scripts/Editor/Inspector/DownloadComponentInspector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public override void OnInspectorGUI()
6262
}
6363
}
6464

65-
if (EditorApplication.isPlaying && PrefabUtility.GetPrefabType(t.gameObject) != PrefabType.Prefab)
65+
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
6666
{
6767
EditorGUILayout.LabelField("Total Agent Count", t.TotalAgentCount.ToString());
6868
EditorGUILayout.LabelField("Free Agent Count", t.FreeAgentCount.ToString());

Scripts/Editor/Inspector/EntityComponentInspector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public override void OnInspectorGUI()
4949
}
5050
EditorGUI.EndDisabledGroup();
5151

52-
if (EditorApplication.isPlaying && PrefabUtility.GetPrefabType(t.gameObject) != PrefabType.Prefab)
52+
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
5353
{
5454
EditorGUILayout.LabelField("Entity Group Count", t.EntityGroupCount.ToString());
5555
EditorGUILayout.LabelField("Entity Count (Total)", t.EntityCount.ToString());

Scripts/Editor/Inspector/EventComponentInspector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public override void OnInspectorGUI()
2525

2626
EventComponent t = (EventComponent)target;
2727

28-
if (PrefabUtility.GetPrefabType(t.gameObject) != PrefabType.Prefab)
28+
if (IsPrefabInHierarchy(t.gameObject))
2929
{
3030
EditorGUILayout.LabelField("Event Handler Count", t.EventHandlerCount.ToString());
3131
EditorGUILayout.LabelField("Event Count", t.EventCount.ToString());

Scripts/Editor/Inspector/FsmComponentInspector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public override void OnInspectorGUI()
2727

2828
FsmComponent t = (FsmComponent)target;
2929

30-
if (PrefabUtility.GetPrefabType(t.gameObject) != PrefabType.Prefab)
30+
if (IsPrefabInHierarchy(t.gameObject))
3131
{
3232
EditorGUILayout.LabelField("FSM Count", t.Count.ToString());
3333

Scripts/Editor/Inspector/GameFrameworkInspector.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,19 @@ protected virtual void OnCompileComplete()
4848
{
4949

5050
}
51+
52+
protected bool IsPrefabInHierarchy(UnityEngine.Object obj)
53+
{
54+
if (obj == null)
55+
{
56+
return false;
57+
}
58+
59+
#if UNITY_2018_3_OR_NEWER
60+
return true;
61+
#else
62+
return PrefabUtility.GetPrefabType(obj) != PrefabType.Prefab;
63+
#endif
64+
}
5165
}
5266
}

Scripts/Editor/Inspector/LocalizationComponentInspector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public override void OnInspectorGUI()
3939
}
4040
EditorGUI.EndDisabledGroup();
4141

42-
if (EditorApplication.isPlaying && PrefabUtility.GetPrefabType(t.gameObject) != PrefabType.Prefab)
42+
if (EditorApplication.isPlaying && IsPrefabInHierarchy(t.gameObject))
4343
{
4444
EditorGUILayout.LabelField("Language", t.Language.ToString());
4545
EditorGUILayout.LabelField("System Language", t.SystemLanguage.ToString());

0 commit comments

Comments
 (0)