void MakeSureConsoleAlwaysOnlyOne() { // make sure that console window is always open as only one. if (ms_ConsoleWindow != null) { // get the container window of this console window. ContainerWindow cw = ms_ConsoleWindow.m_Parent.window; // the container window must not be main view(prevent from quitting editor). if (cw.rootView.GetType() != typeof(MainView)) { cw.Close(); } } }