适配Unity2019版本

This commit is contained in:
monitor1394
2020-03-02 17:59:57 +08:00
parent e807fafdd6
commit d8f57bdad2
2 changed files with 6 additions and 3 deletions

View File

@@ -102,7 +102,7 @@ public class ChartEditorHelper
float defaultWidth = drawRect.width; float defaultWidth = drawRect.width;
float defaultX = drawRect.x; float defaultX = drawRect.x;
drawRect.width = EditorGUIUtility.labelWidth; drawRect.width = EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15;
var displayName = string.IsNullOrEmpty(moduleName) ? prop.displayName : moduleName; var displayName = string.IsNullOrEmpty(moduleName) ? prop.displayName : moduleName;
toggle = EditorGUI.Foldout(drawRect, toggle, displayName, bold ? foldoutStyle : EditorStyles.foldout); toggle = EditorGUI.Foldout(drawRect, toggle, displayName, bold ? foldoutStyle : EditorStyles.foldout);
if (moduleToggle[key] != toggle) if (moduleToggle[key] != toggle)

View File

@@ -90,13 +90,15 @@ namespace XCharts
public static void DestroyAllChildren(Transform parent) public static void DestroyAllChildren(Transform parent)
{ {
#if UNITY_2019_1_OR_NEWER
#else
if (parent == null) return; if (parent == null) return;
#if UNITY_EDITOR && UNITY_2018_3_OR_NEWER #if UNITY_EDITOR && UNITY_2018_3_OR_NEWER
if (PrefabUtility.IsPartOfAnyPrefab(parent.gameObject)) if (PrefabUtility.IsPartOfAnyPrefab(parent.gameObject))
{ {
return; return;
} }
#endif #endif
while (parent.childCount > 0) while (parent.childCount > 0)
{ {
var go = parent.GetChild(0); var go = parent.GetChild(0);
@@ -105,6 +107,7 @@ namespace XCharts
GameObject.DestroyImmediate(go.gameObject); GameObject.DestroyImmediate(go.gameObject);
} }
} }
#endif
} }
public static string GetFullName(Transform transform) public static string GetFullName(Transform transform)