static void CreateConfig() { if (ConfigAsset.I == null) { ConfigAsset.CreateConfig(); } else { Selection.activeObject = ConfigAsset.I; } }
void DrawConfigMenu() { using (var scope = new EditorGUI.ChangeCheckScope()) { using (new GUILayout.HorizontalScope()) { GUILayout.Label("Generate Setting"); if (m_ConfigAsset != null) { GUILayout.Label("ConfigAsset", GUILayout.ExpandWidth(false)); if (GUILayout.Button("Load", GUILayout.ExpandWidth(false))) { m_Config = m_ConfigAsset.GetConfig(); GUI.FocusControl(""); Event.current.Use(); } if (GUILayout.Button("Apply", GUILayout.ExpandWidth(false))) { m_ConfigAsset.UpdateConfig(m_Config); EditorUtility.SetDirty(m_ConfigAsset); } } else { GUILayout.Label("ConfigAsset", GUILayout.ExpandWidth(false)); if (GUILayout.Button("Create", GUILayout.ExpandWidth(false))) { ConfigAsset.CreateConfig(); m_ConfigAsset = ConfigAsset.I; if (m_ConfigAsset != null) { m_Config = m_ConfigAsset.GetConfig(); UpdatePreviewScripte(); } } } } using (new GUILayout.VerticalScope("Box")) { m_Name = EditorGUILayout.TextField("Name", m_Name); m_Config.Output = EditorGUILayout.TextField("Output Dir", m_Config.Output); m_Config.NameSpace = EditorGUILayout.TextField("NameSpace", m_Config.NameSpace); m_Config.NameSuffix = EditorGUILayout.TextField("NameSuffix", m_Config.NameSuffix); m_Config.ReactivePropertyMode = EditorGUILayout.Toggle("ReactivePropertyMode", m_Config.ReactivePropertyMode); m_Config.CommandMode = EditorGUILayout.Toggle("CommandMode", m_Config.CommandMode); m_Config.CommandSuffix = EditorGUILayout.TextField("CommandSuffix", m_Config.CommandSuffix); m_Config.EventValueSuffix = EditorGUILayout.TextField("EventValueSuffix", m_Config.EventValueSuffix); } if (scope.changed) { UpdatePreviewScripte(); } } }