You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This Unity tool allows you to easily create a console and execute commands for your game in Unity. fast, easy and powerful.
Features
Methods, Fields and Properties
Static and non-Static Objects
Public and Private
Method Return Types
Method Arguments (float ,int, string, Vector2-3, Color, Enums) and more
Auto Complete Suggestions
Custom Command Options Callback
Customizable UI
Requirements
Unity 2020 or later
How To Use
add CommandConsoleGUI prefab to the scene or CommandConsoleUI to the canvas whichever you prefer
tweak the settings in the inspector to your liking
add ConsoleCommandAttribute to any field property or method
open the console and type the command than press enter to execute the command
[ConsoleCommand]//or with Constructor parameters[ConsoleCommand(command:"SetPlayerGold",description:"Sets Player Gold Amount",objectExecutionType:MonoObjectExecutionType.Option)]
Parameters
command: the command you need to type in the console to execute
default value: (field, property, method) name
description: command description in the help commands list
default value: string.empty
helpMenu: the option to include this command in the help commands list
default value: True
objectExecutionType: determines how the command would be executed
MonoObjectExecutionType.FirstInHierarchy: will execute on the first object in hierarchy assigned to the command
MonoObjectExecutionType.All: will execute on all objects in hierarchy assigned with the command
MonoObjectExecutionType.Option: will allow the user to choose and execute the command on a specific object from the hierarchy.
This option provides flexibility, as it enables the user to select a single object from the hierarchy and apply the command only to that particular object.
This allows you to add your list of executable options in one command.
submitting the command without arguments will display the list of options.
providing arguments will execute the selected option , e.g. SetGraphics High or SetGraphics 2, argument "2" is the index of the selected option "High"
[ConsoleCommand]publicCommandOptionsCallbackSetGraphics(){varoptions=newCommandOptionsCallback();options.AddOption("Low",()=>QualitySettings.SetQualityLevel(0));options.AddOption("Medium",()=>QualitySettings.SetQualityLevel(1));options.AddOption("High",()=>QualitySettings.SetQualityLevel(2));returnoptions;}[ConsoleCommand]publicCommandOptionsCallbackSetLanguage(){returnnewCommandOptionsCallback(newCommandOption("English",()=>Debug.Log("Language set to English")),newCommandOption("French",()=>Debug.Log("Language set to French")),newCommandOption("Spanish",()=>Debug.Log("Language set to Spanish")));}
Api
Class / Method
Description
CommandsHandler
FetchCommandAttributes()
Fetches all the commands from the static classes and the MonoBehaviours in the scene. This can be called manually if you want to update the commands in the console.