
Want to invoke functions by just writing them in a console or you love using your keyboard more than your mouse? If yes, then this package is just for you!
Improve your workflow with easy integration.* Requires Unity 2023.1.0. or newerThe DevShell-Console supports static and non-static command functions using a simple attribute-based system. This allows you to register and expose methods as console commands with minimal setup.Creating a Static CommandTo create a static command:1. Define a static method in any class.2. Add the [ShellCommand] attribute to it.3. Optionally, provide an alias name inside the attribute. If no alias is specified, the method name will be used as the command name.Access modifiers (public, protected, private) do not matter for command registration.Example:public static class GameCommands{[ShellCommand("reset-game")]private static void ResetGameState(){// Reset logic}}In this example, the console command is reset-game. If no alias was provided, the command would be called via ResetGameState.Creating non-static Command using Shell BindableTo make a component bindable, implement the IShellBindable interface:public class AudioManager : MonoBehaviour, IShellBindable { public void Mute(string category) { Debug.Log($"Muted category: {category}"); } [ShellCommandHide] public void SetVolume(string category, float level) { Debug.Log($"Set volume of {category} to {level}"); } }In this example, Mute is exposed to the console and can be executed at runtime. SetVolume is hidden from the shell due to the [ShellCommandHide] attribute.Command ArgumentsEach parameter of a static method can be annotated with the [ShellArgument] attribute to define:A human-readable nameWhether the argument is optionalAn optional alias used to pass the value via the consoleIf no [ShellArgument] is applied, the parameter is treated as optional by default.Example with Arguments:public static class TimeCommands{[ShellCommand]public static void SetTime([ShellArgument(Alias: "time")] float timeOfDay,[ShellArgument(Optional: true, Alias: "pause")] bool pauseGame = false){// Apply time and pause logic}}Passing Arguments in the ConsoleYou can pass arguments in two ways:1. Named Arguments (Recommended)Use -alias or -parameterName syntax. Argument order does not matter.Example:settime -time 18.5 -pause true2. Positional ArgumentsIf no named arguments are provided, the console will match arguments in order, from left to right.Example:settime 18.5 trueArguments without [ShellArgument] are optional by default.If an alias is defined, use the alias in the console, not the parameter name.Static command methods must be static to be discovered.Use method overloading with caution. While it is supported, ensure that each overloaded command differs clearly in the number of parameters. For example, avoid defining two overloads that both take exactly two arguments, as this can lead to ambiguity during command resolution and undefined behaviour.There must be only one bindable component/class per GameObject