Command Library


Part of the Command System of the UX Foundation and UX Compelete assets

A scriptable object referencing a set of commands and details about how those commands are to be parsed. A command is simply a GameEvent that can be looked up by name. Your game can then listen for these game events to know when a command was ran. This system also handles paramiterizezd commands, that is the arguments following a command can be parsed and sent along with it.

/emote wave

This might be parsed to invoke a Game Event named emote and pass a string argument of wave you can then handle this event and use the argument to determin what animation to play in the case of an emote system.

Fields and Attributes


When parsing should case be respected

public bool useCaseSinsativeCommandNames = false;


What token should be watched for when searching strings for commands

public string commandStartString = "/";


Commands identified as "developer" commands, when parsing you can filter out developers commands. When used these are usually commands that are not restrectied from player access but require an additional layer of effort on the player's part similar to "console commands" in games like Elder Scrolls or Fallout.

If you want to prevent players from running a command, do not innclude it in your released game. If you do include a command in your game your players will find a way to run it.

public List<GameEvent> developerCommands


Commands identified as "user" commands, when parsing. User commands are always searched when parsing and are in constrast to "developer" commands.

public List<GameEvent> userCommands



Attempts to match the input string to a command optionally filtering on user commands only

public bool TryParseCommand(string inputString, 
                            bool userOnly, 
                            out GameEvent gameEvent, 
                            out string argument)


Attempts to match the input string to a command and to raise the matching command event with the provided arguments

public bool TryCallCommand(string inputString, 
                           bool userOnly, 
                           out string errorMessage)


Returns true if the provided string is a command

public bool VerifyCommand(string inputString, 
                          bool userOnly, 
                          out string errorMessage)


parses a command and returns the Command Data.

public CommandData ParseCommand(string inputString, bool userOnly)

Last updated