Utility Scripts
Besides the core CosmosConsole class, there are several utility scripts that provide extra functionality.
Console
UnityCosmosConsole
This MonoBehaviour script is a straightforward console manager holding a singleton reference to a server-only console instance, which is enough for most use cases. The console object is instantiated in Awake() so make sure any references to the singleton in your codebase are made later in the script order (such as Start()).
CosmosConsoleAccessLogger
This MonoBehaviour script logs when client consoles connect, disconnect or send commands to a server console. This is useful for monitoring console activity on a dedicated game server, for example.
CosmosConsoleExecuteOnStartup
This MonoBehaviour script automatically executes all the commands listed in a local .cfg text file upon startup. This file has to be either in the persistent data path, the application data path or the executable path (the parent folder of the application data path on most platforms).
Sample Scene
The sample scene also features several reusable scripts.
Command Handlers
These are the handler scripts for the various commands used in the sample scene. See the command descriptions for more details on the functionality that these handlers implement.
- DebugLogEchoCommandHandler: handles the "debuglog_echo" and "debuglog_echo" commands.
- ObjectsCommandHandler: handles the many "objects_*" commands.
- PerformanceMonitorCommandHandler: handles the "performance_monitor_start" and "performance_monitor_stop" commands.
- PlayerPrefsCommandHandler: handles the "playerprefs_*" commands.
- SceneHierarchyPrintCommandHandler: handles the "scenehierarchy_print" command.
- SystemInfoPrintCommandHandler: handles the "systeminfo_print" command.
Console UI
- CosmosConsoleLogUIView: MonoBehaviour script for use with Unity UI. Handles the console input and output. The ConsoleCanvas prefab provides an example of the expected UI structure.