// Command field input is changed, check if command is submitted public char OnValidateCommand(string text, int charIndex, char addedChar) { if (addedChar == '\t') // Autocomplete attempt { if (!string.IsNullOrEmpty(text)) { string autoCompletedCommand = DebugLogConsole.GetAutoCompleteCommand(text); if (!string.IsNullOrEmpty(autoCompletedCommand)) { commandInputField.text = autoCompletedCommand; } } return('\0'); } else if (addedChar == '\n') // Command is submitted { // Clear the command field if (clearCommandAfterExecution) { commandInputField.text = ""; } if (text.Length > 0) { if (commandHistory.Count == 0 || commandHistory[commandHistory.Count - 1] != text) { commandHistory.Add(text); } commandHistoryIndex = -1; // Execute the command DebugLogConsole.ExecuteCommand(text); // Snap to bottom and select the latest entry SetSnapToBottom(true); } return('\0'); } return(addedChar); }
private void OnDisable() { if (instance != this) { return; } // Stop receiving debug entries Application.logMessageReceivedThreaded -= ReceivedLog; #if !UNITY_EDITOR && UNITY_ANDROID if (logcatListener != null) { logcatListener.Stop(); } #endif // Stop receiving commands commandInputField.onValidateInput -= OnValidateCommand; DebugLogConsole.RemoveCommand("save_logs"); }