public override void OnInspectorGUI() { //base.OnInspectorGUI(); if (!Application.isPlaying) { // 配合 Unity 2018 的嵌套 Prefab 功能,因此不允许嵌套设计器 if (elementDesigner.ParentDesigner == null) { //EditorGUILayout.Separator(); if (GUILayout.Button("GenerateCode")) { ElementEditorUtils.GenerateCodeForTree(elementDesigner); } } } }
public override void OnInspectorGUI() { //base.OnInspectorGUI(); var list = elementDesigner.GetComponentsInChildren <ElementCreator>(); GUILayout.Label(list.Length + " Creator"); if (!Application.isPlaying) { if (GUILayout.Button("Preview")) { elementDesigner.Preview(); } if (GUILayout.Button("RemovePreview")) { elementDesigner.RemovePreview(); } EditorGUILayout.Separator(); if (GUILayout.Button("GenerateCode")) { ElementEditorUtils.GenerateCodeForTree(elementDesigner.gameObject); } } }