- Lightweight developer console for runtime use.
- Minimal UI built with UI Toolkit.
- Supports most primitive types as well as common ones such as
Vector3orColor. - Versatile debug log.
- Up to 63 custom bit flags used for filtering displayed logs in UI.
- Unity 2023.3
- UI Toolkit
- Support methods with optional arguments.
- Support custom input parsing and types.
💬 This project is an aggregate of features from at least two console solutions I've written over the years for Unity projects.
If you find this plugin useful you can support me by donating, which allows me to allot more of my free time to maintenance (and is very appreciated).
- Open Package Manager
- Paste GitHub URL:
https://github.com/Smidgens/unity-console.git#<version_tag>
Create->Console->Console Asset
An instance of a Console Asset houses all state and command bindings.
There are three routes for registering commands:
- Script
- Asset
- C# attributes (static commands)
Supported argument types:
string"example"float10.0|10fint1boolt|fVector2<1,2>Vector3<1,2,3>Vector4<1,2,3,4>Color#fff
Component->Smidgenomics->Console->Console Command
Scene commands allow fields and methods on scene objects to be registered with Console.
A typical example might be to make the main camera's fov editable through the console.
Create->Console->Console Command.
Asset commands work the same as scene commands but will persist through loads. These types of commands are useful if you need to bind methods or properties on custom scriptable objects to the console. Exposing player data for example.
To register an asset command with the console it must be added to a Console Asset.
Attributes are the primary way of registering static fields and methods with console.
Basic setup:
- Add assembly reference to
Smidgenomics.Unity.Console. - Add
ConsoleAssemblyattribute to your target assembly:[assembly:ConsoleAssembly] - Add
ConsoleClassattribute to class whose members you want registered. - Add
ConsoleCommandattribute to field, method, or property.
Notes:
ConsoleClass.exposeAllcan be used to register all of its eligible fields and methods with console. This serves as an alternative toConsoleCommand.HideInConsolecan be used to opt-out specific members out.ConsoleClass.scopeName, if provided will nest all of its commands under given prefix. For examplesettings.resolution
Console Window UI can be added to toolkit UI through the UI builder (Custom Controls/Console/ConsoleWindow or referenced like so <Smidgenomics.Unity.Console.ConsoleWindow console-asset="..."/>. A reference to a Console Asset should be supplied.
Several USS variables can be declared in your stylesheet to override the default console style. This will likely be necessary as the defaults are built with 1920x1080 as a reference resolution and will need to be adjusted accordingly for anything else.
Variables:
--sm-console-font--sm-console-spacing--sm-console-divider-color--sm-console-background-color--sm-console-input-height--sm-console-input-spacing--sm-console-input-font-size--sm-console-toolbar-spacing--sm-console-toolbar-height--sm-console-focus-color--sm-console-log-font-size--sm-console-rounding

