Skip to content

Instantly share code, notes, and snippets.

@joshcamas
Last active September 7, 2019 13:55
Show Gist options
  • Save joshcamas/9da8333b167ddf8f20691af994b9aade to your computer and use it in GitHub Desktop.
Save joshcamas/9da8333b167ddf8f20691af994b9aade to your computer and use it in GitHub Desktop.
Disabling annoying "select all on focus" for EditorUI.TextArea
//Just set EditorGUI.s_SelectAllOnMouseUp (an internal variable) to false every frame / every time you draw.
//This variable is usually set to true in certain circumstances, so we're overwriting the value.
//I honestly don't know why this feature exists, it's quite annoying and never useful.
//Of course, be sure to cache the field!
selectAllField = typeof(EditorGUI).GetField("s_SelectAllOnMouseUp", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Default);
selectAllField.SetValue(null, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment