// // Update the input every frame // This gets new key input and calls the OnInputText callback // void Update() { if (Input.GetKeyDown(KeyCode.Tab) || Input.GetKeyDown(KeyCode.BackQuote)) { ishowWindow = !ishowWindow; if (ishowWindow) { console = new ConsoleTestWindows.ConsoleWindow(); input = new ConsoleTestWindows.ConsoleInput(); console.Initialize(); console.SetTitle("Test command"); input.OnInputText += OnInputText; Application.logMessageReceived += HandleLog; } else { CloseConsoleWindow(); } oldWindowState = ishowWindow; } // input update if (ishowWindow && null != input) { input.Update(); } if (ishowWindow != oldWindowState && !ishowWindow) { CloseConsoleWindow(); } oldWindowState = ishowWindow; }
void CloseConsoleWindow() { if (console != null) { console.Shutdown(); console = null; input = null; } }