Command Director

Like what your seeing?

Support us as a GitHub Sponsor and get instant access to all our assets, exclusive tools and assets, escalated support and issue tracking and our gratitude. These articles are made possible by our GitHub Sponsors ... become a sponsor today!

Introduction

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

Changes the configured Default State for the Cursor system.

Events

evtCommandFound

Occurs when a command is found in parsed text and provides a refernce to the found command.

You would add a listener on this event via theUnity inspector as you would for other Unity events or in code such as:

Assuming a handler in the form of

private void HandleEvent(CommandData command)
{
}

Then you would register the event such as:

commandDirector.evtCommandFound.AddListener(HandleEvent);

When you no longer need this handler you should remove it for example when the behviour using it is destroyed

void OnDestroy()
{
    commandDirector.evtCommandFound.RemoveListener(HandleEvent);
}

Fields and Attributes

Library

public CommandLibrary library;

A reference to the command library to be used

UserOnly

public BoolReference userOnly;

Should this directory handle user only commands

Methods

ParseInput

Parses an input string and raises the command found event as required. This is most offten used with UI integrations such as a player console or chat box.

public void ParseInput(string value);

ParseCommand

Parses an input string and returns the command data found. This is a more direct solution and doesn't trigger the evtCommandFound. You will need to handle the CommandData your self.

public CommandData ParseCommand(string value);

Last updated