cemuka / command-console

Easy to setup and use command console for unity runtime.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

command-console

Command Console

Inspired by Quantum Console from unity asset store. It looks pretty awesome.

Usage

Simply log any string

Console.Log("This is the way");
Console.Log("Also with text support for colors", "green");

Just call Initialize to setup. It will create the command view from Resources. Add your commands with Register.

private void Start()
{
    Console.Initialize();
    Console.Register("greet", Greet);
}

private void Greet(string[] args)
{
    if (args != null && args.Length >= 1)
    {
        var log = "Greetings, " + string.Join(" ", args);
        Console.Log(log, "green");
    }
    else
    {
        Console.Log("Err, missing argument!");
    }
}

Easily show and hide.

private void Update()
{
    if (Input.GetKeyDown(KeyCode.DoubleQuote))
    {
        if(Console.IsActive) 
        {
            Console.Hide();
        }
        else
        {
            Console.Show();
        }
    }
}

LICENSE

MIT Cem Ugur Karacam

About

Easy to setup and use command console for unity runtime.


Languages

Language:C# 100.0%