I’ve been trying to get access to the TextEditor for a TextArea object in an Editor window. I’ve used the same patterns I see in other examples and I think they work only in game gui, not editor gui. For example this works:
Rect bounds = new Rect(10, 20, Screen.width - 10, Screen.height - 20);
stringToEdit = GUI.TextArea(bounds, stringToEdit);
int controlID = GUIUtility.GetControlID(bounds.GetHashCode(), FocusType.Keyboard);
TextEditor editor = (TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), controlID -1);
but this does not:
the_text= EditorGUILayout.TextArea(the_text, GUILayout.ExpandHeight(true));
int controlID = EditorGUIUtility.GetControlID(b.GetHashCode(), FocusType.Keyboard);
TextEditor editor = (TextEditor)EditorGUIUtility.GetStateObject(typeof(TextEditor), controlID -1);
Am I right in thinking TextEditor can’t be accessed in the editor? Or am I missing something obvious?