Appearance
Developer Console
The in-game developer console combines buffered RedEngine logs with commands discovered from loaded assemblies. It supports history, suggestions, completion, typed arguments, and registered instance targets.
Press the backquote key (`) to toggle it. The console includes:
- live formatted logs;
- command history stored in
PlayerPrefs; - Up/Down history navigation;
- command and parameter suggestions;
- Tab completion;
- mobile keyboard inset handling;
- configurable retained log and command counts.
Add a static command
csharp
using RedEngine.Console;
using UnityEngine;
public static class ArenaCommands
{
[ConsoleCommand("arena.timescale", Description = "Sets Unity time scale.")]
private static string SetTimeScale(float value = 1f)
{
Time.timeScale = Mathf.Clamp(value, 0f, 4f);
return $"Time scale: {Time.timeScale:0.##}";
}
}Commands may be public or private. Discovery runs after assemblies load, names are case-insensitive, and a non-null string result is printed back into the console.
Example calls:
text
arena.timescale
arena.timescale 0.5
help arenaAdd suggestions
Use fixed values when the valid set is known at compile time:
csharp
[ConsoleCommand("match.state")]
private static string SetMatchState(
[CommandSuggestion("Warmup", "Playing", "Finished")] string state)
{
return $"Requested state: {state}";
}Or resolve suggestions from a parameterless static method returning IEnumerable<string>:
csharp
[ConsoleCommand("player.kick")]
private static string Kick(
[CommandSuggestion(nameof(GetPlayerNames))] string playerName)
{
return TryKick(playerName) ? "Player disconnected" : "Player not found";
}
private static IEnumerable<string> GetPlayerNames() =>
FindObjectsByType<PlayerIdentityView>(FindObjectsSortMode.None)
.Select(player => player.DisplayName);A fully qualified TypeName.MethodName can point to a provider declared on another type.
Instance commands
Instance methods run against registered objects of their declaring type:
csharp
public sealed class EnemyDirector : MonoBehaviour
{
private void OnEnable() => ConsoleRegistry.RegisterObject(this);
private void OnDisable() => ConsoleRegistry.UnregisterObject(this);
[ConsoleCommand("enemies.clear", Description = "Despawns active enemies.")]
private int ClearEnemies(bool includeBosses = false)
{
return DespawnEnemies(includeBosses);
}
}Always unregister scene objects. If no target is registered, the console reports Missing command target instead of invoking a stale object.
Supported arguments
Built-in parsers support:
- quoted strings and escape sequences;
- booleans (
true,false,1,0,yes,no,on,off); - integer and floating-point values using invariant culture;
- case-insensitive enums;
Vector2,Vector3,Vector4,Vector2Int, andVector3Intas(x,y,...);GameObjectlookup by name;- arrays and common generic collections as
[a,b,c]; - tuples as
(a,b,c).
Register project types through CommandArgumentParser.AddParser with an ICommandArgumentParser implementation before commands are invoked.
text
teleport (10,2,-4)
spawn.wave [Grunt,Grunt,Sniper]
camera.mode "Free Fly"
damage.apply Player 25 FireBuilt-in commands
The base console provides help, help filter, and quit. When a world is running, gameplay diagnostics also expose:
match.stateandmatch.restart;player.list;player.kill <playerId>;player.respawn <playerId>;player.kick <playerId>.
Commands that mutate match or player state require server or single-player authority. Player IDs are Fusion PlayerRef.PlayerId numbers shown by player.list.
Channel configuration and log receivers are documented separately in Diagnostics.