Skip to content

Instantly share code, notes, and snippets.

Created October 7, 2021 21:20
What would you like to do?
Gets a reference to the main Unity editor window.
static Object GetMainEditorWindow()
var containerWindowType = typeof(EditorWindow).Assembly.GetType("UnityEditor.ContainerWindow");
var showModeField = containerWindowType.GetField("m_ShowMode", BindingFlags.Instance | BindingFlags.NonPublic);
return Resources
.First(window => (int)showModeField.GetValue(window) == 4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment