A runtime debug console for Unity with a Unix-like command syntax.
RetroConsole gives you an in-game terminal window for inspecting and manipulating your project while it runs. It ships with a set of built-in commands, a live log viewer, basic file and directory utilities, and a small API for writing your own commands.
- Draggable, resizable terminal window with a full input/output buffer
- Live Unity log viewer with filtering by message type
- Overlay mode — toggle the console over your game with the
`key - Built-in file and directory utilities — read, create, delete
- Command history persisted between sessions
- Familiar Unix-like feel: prompt format, flags,
Ctrl+Cto interrupt - A small, explicit API for adding your own commands
- Command registration through a ScriptableObject — no changes to the console core
- Unity 6 (developed and tested on
6000.3.8f1) - TextMeshPro
- Works with both the legacy Input Manager and the new Input System
- Download the latest
.unitypackagefrom the Releases page - In Unity: Assets → Import Package → Custom Package…
- Select the downloaded file and import
- Open
Assets/RetroConsole/Scenes/Demo.unityto see a working setup - To add the console to your own scene, drop the
Terminalprefab (Assets/RetroConsole/Prefabs/Windows/) into a Canvas - The window requires a Workzone object to support its full functionality — window dragging, resizing and status bar. See how it is wired up in the demo scene
- For a console that stays available across scenes, use the
TerminalOverlayprefab instead — it survives scene loads and toggles with the`key
Console files are stored under Application.persistentDataPath/RConsole.
| Command | Description |
|---|---|
help |
Lists available commands with their descriptions |
clear |
Clears the current terminal buffer |
history |
Prints the contents of historyrc |
gamedata |
Prints developer, product name, engine version and build info |
lock |
Sets the current buffer to read-only |
fullscreen |
Toggles the terminal window between windowed and fullscreen |
close |
Closes the current terminal window |
exit |
Terminates the terminal window |
Shipped as external commands (prefabs, registered through ExternalCommands):
| Command | Description |
|---|---|
log |
Streams Unity console output into the terminal |
echo |
Writes input text to standard output |
cat |
Writes the contents of a file or input stream to standard output |
mk |
Creates a file |
rm |
Removes a file or directory |
test |
Demo command — does nothing, used for testing and demonstration |
Attaches to Unity's log stream and prints messages into the buffer as they arrive, colour-coded by type. Called without arguments, it shows everything. Pass flags to filter:
| Flag | Shows |
|---|---|
-l |
Logs |
-w |
Warnings |
-e |
Errors |
-a |
Assertions |
-x |
Exceptions |
-s |
Include stack traces |
log -e -x -s # errors and exceptions, with stack traces
log -w # warnings only
log # everything
Only one logger can run at a time. Press Ctrl+C to stop it and return to the prompt.
The console is a linear command processor. It takes user input, runs the matching command, and writes the result back into the buffer.
Commands come in two kinds:
- Built-in — handled inside the console core (
clear,history,exit,lock, and so on) - External — separate
MonoBehaviourscripts on prefabs, written against the API and registered in anExternalCommandsasset
Every command follows the same path: enter → run → exit. You decide what happens at each step, but control always returns to the terminal master when the command finishes.
Inherit from TerminalCommand and implement IOrder:
using UnityEngine;
using RetroConsole.Console;
using RetroConsole.Extented;
namespace MyGame.Commands
{
[AddComponentMenu("RetroConsole/Terminal Commands/Hello")]
public class Hello : TerminalCommand, IOrder
{
public override void Init()
{
buffer.PrintLine("Hello from a custom command!");
OnExit();
}
public override void OnExit()
{
buffer.SetOrder(master);
buffer.SetFormat($"unity@{Application.productName}");
}
}
}Assets/RetroConsole/Scripts/Terminal/API/TerminalCommand.cs is the reference implementation — it doubles as a working template you can copy from.
- Create a prefab with your script attached
- Open your
ExternalCommandsasset (Assets/RetroConsole/Presets/ExternalCommands.asset) - Add an entry: the command name as typed by the user, the prefab, and a description shown by
help
| Method | When it runs |
|---|---|
Init() |
On command initialization — the entry point |
OnInputEnter(string input) |
After the user submits input requested by the command |
OnExit() |
When the command finishes. Must hand control back to the terminal master |
OnArrowUp() / OnArrowDown() |
On up / down arrow key press |
OnCtrlC() |
On Ctrl+C — override it for long-running commands so the user can interrupt them |
You rarely need to override all of them. For most commands Init() and OnExit() are enough, and OnInputEnter can be skipped entirely — use it only when your command needs to prompt the user for something. Override OnCtrlC() when your command keeps running after Init(), as log does.
| Member | Purpose |
|---|---|
input |
The raw command line as entered |
separatedinput |
The command line split into tokens — use this to read flags and arguments |
buffer |
The terminal buffer — see below |
master |
The terminal master. Pass it to buffer.SetOrder() in OnExit() to return control |
format |
The prompt string shown while the command is active |
| Method | Purpose |
|---|---|
PrintLine(string) |
Writes a line to the output. Supports TMP rich text, including <color=…> |
Print(string) |
Writes without a line break |
InsertInput(string) |
Puts text into the input field |
ClearBuffer() |
Clears the output |
SetFormat(string) |
Changes the prompt |
SetOrder(IOrder) |
Hands control to another command, or back to the master |
SetReadOnly(bool) |
Locks or unlocks input |
separatedinput holds the tokenized command line, so a call like:
rm -r -f myfolder
arrives as ["rm", "-r", "-f", "myfolder"] — parse it however your command needs. See Log.cs for a worked example of flag parsing.
Assets/RetroConsole/
├── Prefabs/
│ ├── TermialCommands/ # command prefabs
│ ├── Windows/ # Terminal window and base window prefabs
│ └── TerminalOverlay.prefab
├── Presets/
│ └── ExternalCommands.asset
├── Resources/ # fonts, sprites, audio
├── Scenes/
│ └── Demo.unity # working example
├── Scripts/
│ ├── Misc/ # constants, tokenizer, filesystem helpers, workzone, overlay
│ ├── Terminal/
│ │ ├── API/ # IOrder, TerminalCommand, ExternalCommands
│ │ └── Commands/ # shipped external commands
│ └── WindowBaseLogic/ # window move, resize, status bar
└── ThirdParty/
└── TextMeshPro/ # modified TMP_InputField
- Path separators are hardcoded for Windows. Other platforms are untested.
Assets/RetroConsole/ThirdParty/TextMeshPro/TMP_InputFieldMod.cs is a fork of Unity's TMP_InputField.
The fork exists because the console needs access to the input field's internal editing methods (Backspace, Delete and similar), which have no public or protected accessor. Working around this from the outside proved fragile, so the class was forked with minimal changes — access modifiers only, no logic changes.
This file is distributed under the Unity Companion License. See Assets/RetroConsole/ThirdParty/LICENSE.md. The rest of the package is MIT.
MIT, except for the contents of Assets/RetroConsole/ThirdParty/ — see above.