How to create console commands
This tutorial is intended to guide you through creating custom console commands using the new console attributes.
[ConsoleCommand(name: "useful", docs: "this command is useful.")]
public static void MyCommand(string[] args)
{
Debug.Log("You entered " + args.Length + " arguments!");
}[ConsoleCommand(name: "useful", docs: "this command is useful.")]
public static string MyCommand(string[] args)
{
return "You entered " + args.Length + " arguments!";
}public string myNonStaticVariable = "some stuff";
public MyModType instance;
void Start(){
instance = this;
}
[ConsoleCommand(name: "useful", docs: "this command is useful.")]
public static string MyCommand(string[] args)
{
return "My Variable : " + instance.myNonStaticVariable;
}Last updated