// get state object EditingState state = GUIUtility.GetStateObject(typeof(EditingState), GUIUtility.GetControlID(FocusType.Passive)) as EditingState;
using (new EditorGUILayout.HorizontalScope(style)) { Rect editButtonRect = new Rect(position.x, position.y, 16f, 16f); if (GUI.Button(editButtonRect, "E")) { // well since it's a class we dun need to set it back :> state.IsEditing = !state.IsEditing; }
if (GUILayout.Button("X", GUILayout.Width(18))) { state.IsEditing = !state.IsEditing; } if (state.IsEditing) { // show text field tagStr = EditorGUILayout.TextField(tagStr); } else { // show lable EditorGUILayout.LabelField(tagStr); } } } }