private static string TextFieldWithUndo( this Object obj, string value, GUIContent label, Regex regex = null ) { var originalColor = GUI.color; if (GUI.enabled && string.IsNullOrWhiteSpace(value)) { GUI.color = Color.red; } EditorGUI.BeginChangeCheck(); var newValue = ScriptableEventGUI.TextField(value, label); GUI.color = originalColor; if (newValue != null && regex != null) { newValue = regex.Replace(newValue, string.Empty).Trim(); } if (EditorGUI.EndChangeCheck()) { RecordUndo(obj, label); } return(newValue); }
protected override string DrawArgField(string value) { return(ScriptableEventGUI.TextField(value)); }