private void OnGUI() { if (_labelStyle == null) { _labelStyle = new GUIStyle(GUI.skin.label) { alignment = TextAnchor.MiddleRight }; } if (_buttonStyle == null) { _buttonStyle = new GUIStyle(GUI.skin.button) { fixedWidth = 80f, fixedHeight = 30f, fontSize = 16 }; } if (_showButtons) { EditorGUILayout.Space(25); } EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Saving path: ", _labelStyle, GUILayout.Width(100)); string path = EditorGUILayout.TextField(_path); EditorGUILayout.EndHorizontal(); if (path != _path) { _path = path; EditorPrefs.SetString(PrefabsTools.PrefabsPathKey, _path); } EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Ask Every Time ", _labelStyle, GUILayout.Width(100)); bool askEveryTime = EditorGUILayout.Toggle(_askEveryTime); EditorGUILayout.EndHorizontal(); if (askEveryTime != _askEveryTime) { _askEveryTime = askEveryTime; EditorPrefs.SetBool(PrefabsTools.SavingPopupKey, _askEveryTime); } if (!_showButtons) { return; } EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Save", _buttonStyle)) { SaveButtonPressed?.Invoke(); Close(); } GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); }
private void SaveButton_Click(object sender, EventArgs e) { SaveButtonPressed?.Invoke(); }