A runtime developer console that discovers and executes cheat methods via reflection, with autocomplete support.
- Overview
- Marking Methods as Cheats
- Setting Up the Console
- Running Commands
- Autocomplete
- Toggle Options
- Adding Parameter Types
- Integration
- API Reference
Cheat Console scans your assemblies for methods marked with [Cheat] and makes them callable at runtime through a text console no manual registration needed. It handles both static methods (found by scanning assemblies) and instance methods on scene GameObjects (found by scanning the hierarchy).
Type a command, hit Enter, and the method runs. Tab-completion and Up/Down arrow navigation help with discoverability. The console UI is loaded from a prefab on first use, so it has no scene setup cost until it's actually toggled open.
Add [Cheat] to any static or instance method. The method name becomes the command name by default; pass a string to override it.
Static cheat (called by name alone):
[Cheat]
public static void GiveGold() { /* ... */ }
[Cheat("gold")]
public static void GiveGold(int amount) { /* ... */ }Instance cheat (called via GameObject path):
public class Player : MonoBehaviour
{
[Cheat]
public void SetHealth(int value) { /* ... */ }
[Cheat("kill")]
public void KillPlayer() { /* ... */ }
}Supported parameter types out of the box: int, float, string, uint, GameObject.
1. Add a toggle to the scene
Add one of the toggle components to any GameObject in your scene (see Toggle Options). The console UI prefab is loaded automatically from Resources/CheatUI on first open nothing else is required.
2. Configure StaticCommandRunner assemblies
StaticCommandRunner needs to know which assemblies to scan for static [Cheat] methods. Select it in the Inspector and click Update Assemblies it scans all loaded assemblies and adds any that contain static cheat methods automatically.
To add assemblies manually, the Assembly Dropdown Selector field shows a dropdown of all available assemblies in the project.
3. Configure InstanceCommandRunner (optional)
InstanceCommandRunner scans the scene hierarchy for [Cheat]-marked instance methods at console open time. Enable Auto Complete Instance Cheats to have all found instance cheats added to the autocomplete list automatically.
CheatName
CheatName arg1, arg2, arg3
Examples:
GiveGold
GiveGold 500
Destroy Player
Instance cheats are called using the full GameObject hierarchy path, followed by a dot and the method name:
GameObjectPath.CheatName
GameObjectPath.CheatName arg1, arg2
Examples:
Player.SetHealth 100
World/Enemies/Boss.kill
Type -help (or whatever commandName is set to on HelpCommandRunner) to list all available cheats with their parameters:
-help
- Tab — accept the current suggestion and move the cursor to the end
- Up Arrow — cycle to the next matching command
- Down Arrow — cycle to the previous matching command
As you type, the autocomplete suggestion is shown in a secondary text element next to the input field. Only commands that start with the current input are shown.
| Component | Trigger |
|---|---|
UnityDefaultInputConsoleToggle |
Configurable KeyCode (legacy Input system) |
ButtonConsoleToggle |
UI Button click |
PhoneGameCheatConsoleToggle |
Circular gesture on touch screen (configurable repeat count) |
UnityInputGameCheatConsoleToggle |
InputActionReference (new Input System — uncomment to enable) |
All toggles inherit from GameCheatConsoleToggle, which lazy-loads the CheatUI prefab from Resources on the first toggle.
To support a custom type as a cheat parameter, create a deserializer:
[GameCheatDeserializer(typeof(Vector3))]
public class Vector3CheatParameterDeserializer : GameCheatParameterDeserializer
{
public override object Deserialize(string data)
{
// data format: "1,0,2" → Vector3(1, 0, 2)
var parts = data.Split(',');
return new Vector3(
float.Parse(parts[0]),
float.Parse(parts[1]),
float.Parse(parts[2]));
}
}GameCheatDeserializerFactory discovers all deserializers automatically via reflection at startup — no registration needed.
| System | How It Integrates |
|---|---|
| Damage System | DamageableManager exposes a [Cheat] method to apply damage to an entity directly from the console |
| Resistances | Resistances exposes a [Cheat] method to add resistance values at runtime |
| Any module | Add [Cheat] to any static or instance method — the console picks it up automatically on the next open |
[Cheat] // uses method name as command name
[Cheat("customName")] // override command namevoid ToggleConsole(); // show or hide the console UI// Inherit to support a new parameter type
public abstract object Deserialize(string data);Mark the subclass with [GameCheatDeserializer(typeof(YourType))].
// Inherit to create a new toggle mechanism
protected void ToggleConsole(); // loads prefab if needed, then togglesvoid AddAutoCompleteWord(string word); // register a command for autocomplete
void ClearAutoComplete(); // remove all registered words