GitmanikUnityConsole is a in-game console system allows developers to add and execute custom commands during runtime. It provides a flexible and extensible way to debug, test, and interact with your game or application.
Command system leverages Reflection providing quick and easy solution for creating functions behaving as commands. The console automatically discovers and registers commands from all assemblies in the current domain. The console supports multi-parameter commands, but all parameters must be strings.
- In-game console with command input
- Custom command system using attributes
- Support for Unity debug log integration
- Customizable console appearance
- Built-in command listing and help functionality
- Add package using Package Manager:
- Open Package Manager
- Install package from git URL..
https://github.com/Gitmanik/GitmanikUnityConsole.git
- Drag GitmanikConsole prefab into your scene
- Customize layout and appearance to your liking
- Toggle the console visibility using the ToggleConsole() method.
Use the following methods to print messages to the console:
Print(string message, string color = "93e743") // Print a regular message
PrintWarning(string message) // Print a warning message
PrintError(string message) // Print an error message- Enable Unity Logging: Toggle to capture Unity debug logs in the console
- Character Limit: Set a maximum character limit for the console output
To create a custom command:
- Create a static method with the desired functionality.
- Add the [ConsoleCommand] attribute to the method, specifying the command name and description.
- Ensure the method returns a bool (true for success, false for failure).
Use string parameters for any command arguments.
Example:
[ConsoleCommand("hello", "Prints a greeting message")]
public static bool HelloCommand(string name)
{
GitmanikConsole.singleton.Print($"Hello, {name}!");
return true;
}- Only string parameters are supported for custom commands.
- The console is designed for single-instance use (singleton pattern).
