Easy function/command registration based on String

You can copy the raw code from here

How to use

To Register

Command CMD = new Command();

CMD.Register(new CommandDelegate("commandString", functionName));
//OR You can call it static and CMD will not be required.  Your choice
Command.Register(new CommandDelegate("commandString", functionName));

To Check

CMD.Process(commandString, objData);
//OR if you want to do it static
Command.Process(commandString, objData);

Features

  • Register callback commands
  • Associate Functions with Strings
  • Passes along an Object for information so it can contain any amount or combination of data due to custom classes

Example Situations

  • Ping/Pong
  • Any Event
  • Events for Debugging purposes
  • Networking
  • Animations
  • Coroutines
  • Multithreading
  • Unity
  • Console Commands
  • String based commands and arguments
  • Scripting Language
  • Many more!

Leave a Comment