[Command][Description("Gives 5000 coins to the player")]publicstaticvoidMotherlode(){ coins +=5000;}
Commands can have a description added to them with the [Description] attribute.
To see the description of a command, type help <command name> in the command field.
[Prefix("score")]publicstaticclassScoreManager{ [Command]publicstaticint Current { get; set; } [Command]publicstaticvoidReset() { Current =0; }}
Commands can be organized together by using the [Prefix] attribute on a class, which then groups all the commands in that class under the same prefix.
It can be used on classes, methods or properties.
The above example would result in the commands looking like this in the command field:
The prefix character can be changed in project settings. See the settings section for more details.
Commands can be constrained to only show up in edit-mode, and not be shown in play-mode, with the [EditorOnly] attribute.
It can be used on classes, methods or properties.
[Command][RuntimeOnly]publicstaticvoidHealPlayers(int amount){Player[] players =FindObjectsByType<Player>(FindObjectsSortMode.None);foreach (var player in players) {player.Health+= amount; }}
Commands can be constrained to only show up in play-mode, and not be shown in edit-mode, with the [RuntimeOnly] attribute.
It can be used on classes, methods or properties.