Skip to Content
ExtendingConsole

Console (in-game)

Usage/reference page for the in-game console. For internal service architecture and runtime internals, see Console service.

The Gnosis console is a text field where you run small expressions against the live engine: list services, call functions, inspect metadata, and clear logs. It is backed by the Console permanent service; see Console service for architecture, state paths, and input action ids.

Opening the console

  • Enable the console in Debug Settings first (desktop builds only; Persistent.settings.enableConsole must be true or the console stays disabled).
  • Use your bound ConsoleToggleVisibility action (Rewired → REQUEST_INPUT_ACTION). Opening via direct SetOpen(true) is intentionally not supported from JSON.
  • Default Rewired binding for ConsoleToggleVisibility is /.

Built-in invoker commands

These are implemented on GnosisConsoleCommandInvoker (C# [ConsoleCommand]). They are not the same as CallService(SomeService, …) — they are shorthand parsed by the invoker.

Zero-argument commands may be typed with or without trailing (), for example Help or Help(), ListServices or ListServices(). Commands that need arguments still use Name(arg1, …). Generic invocations must keep parentheses, e.g. Name<T>().

CommandWhat it does
Help()Prints the full catalog of registered command signatures (grouped sections).
Help("CallService")Prints usage for one command name (signature line from the catalog).
ListServices()Lists active service ids from the engine.
ListFunctions("Console")Lists callable functions for a service id.
DescribeFunction("Console", "ClearConsole")Parameter / return metadata for one function.
CallService(Console, GetState, {})Generic JSON service call; works for any service/function the engine exposes.
ReadFromStore()Fast root browse (paginated, shallow for container values).
ReadFromStore("Persistent.settings")Reads a store path as JSON (paginated).
ReadFromStore("Persistent.settings", 2)Reads a specific page for object/list paths.
WriteToStore("Persistent.settings.autoScroll", "2")Writes one value directly to store path (no service call wrapper).

ReadFromStore shape

ReadFromStore() ReadFromStore(storePath) ReadFromStore(storePath, page)
  • Output has one colored banner line (page X of Y · path) and then JSON.
  • JSON body mirrors store serialization for that page.
  • For non-root path reads, JSON is wrapped by the last segment (for example Persistent.settings renders as { "settings": { ... } }).
  • Root reads are intentionally shallow for object/list values to avoid frame spikes.
  • Deep reads are safety-guarded: if branch traversal exceeds console limits (nodes/depth), command returns a warning to narrow the path or export.

WriteToStore shape

WriteToStore(storePath, valueJson)
  • Writes directly into State.Root at the given dot path.
  • Missing parent object segments are created automatically.
  • This updates live in-memory state; it does not force-save disk by itself.

CallService shape

CallService(serviceId, functionName, payloadJson?)

Omit payloadJson when empty, or pass {} as a bare object — you do not need to wrap it as "{}". The parser treats {…} as a single scoped argument, so JSON payloads can be written directly (still valid JSON inside the braces). Examples:

CallService(Console, ClearConsole, {}) CallService(Console, InvokeCommand, {"commandText":"ListServices()"})

Aliases (Persistent.console.commandAliases)

Define full-line shortcuts in persistent state so players or designers can type clear() instead of a long CallService(…).

persistent.json (excerpt)
{ "Persistent": { "console": { "commandAliases": [ { "from": "clear()", "to": "CallService(Console, ClearConsole, {})" } ] } } }

Persistent.console knobs for store reads

Add this key under Persistent.console:

persistent.json (excerpt)
{ "Persistent": { "console": { "readFromStorePageSize": 1024 } } }
  • Used by ReadFromStore pagination.
  • Current default is 1024 when missing.

Tips

  • Prefer Help() once to discover signatures, then CallService for anything that lives on a named service.
  • Unity logs can be mirrored into the console when the adapter’s intercept options are enabled; they do not auto-open the console in current engine builds.
  • Heavy reflection for the command table is lazy (first use); optional prewarm exists on ConsoleAdapter for editor/session profiling tradeoffs.
Last updated on