Skip to main content

ConsoleDisplay

A class in Root.Township, the global namespace.

Shows the latest server console log lines in a UI Text, coloured by log level.

Constructors​

MemberWhat it is
ConsoleDisplay()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

4 private and internal fields
MemberWhat it is
private List<ConsoleDisplay.Log> logsLog lines kept for display.
private static readonly Dictionary<LogLevel, string> logTypeColorsHex colour per log level: red for errors, yellow for warnings, black otherwise.
private int rowsMost lines shown.
private Text textThe UI text that shows the log.

Methods​

3 private and internal methods
MemberWhat it is
private void HandleLog(string message, LogLevel logLevel)Adds a log line, drops the oldest past rows, and rebuilds the text.
private void OnDisable()Stops listening to the server console log.
private void OnEnable()Gets the Text and starts listening to ServerConsoleLogTarget.LogSent.