anarkila / DeveloperConsole

Developer Console for Unity
MIT License
36 stars 1 forks source link
csharp debugging-tool unity unity3d unity3d-plugin

Developer Console

Developer Console for Unity with easy integration to existing projects.

WebGL demo

Use cases

thumbnail

Getting Started

  1. Download and import DeveloperConsole package into your project
  2. Drag & drop DeveloperConsole prefab into your scene
  3. Add [ConsoleCommand()] attribute to your methods like below. See ConsoleExamples.cs for all examples.
  4. Play your scene and press § to toggle Developer Console
using UnityEngine;

public class ExampleScript : MonoBehaviour {

    [ConsoleCommand("test")]
    private void Test() {
        Debug.Log("Called 'test' from Console!");
    }

    [ConsoleCommand("test_int")]
    private void TestInt(int i) {
       // single parameter allowed types: 
       // int, float, string, bool, double, char, string[], Vector2, Vector3, Vector4, Quaternion
       Debug.Log(string.Format("Called 'test_int' with value: {0} from Console!", i));
    }

    [ConsoleCommand("test_multi")]
    private void TestMulti(int i, float f) {
       // multi parameter allowed types:
       // int, float, string, bool, double, char
       Debug.Log(string.Format("Called 'test_multi' with value: {0} and {1} from Console!", i, f));
    }
}

Features

Default Commands

Developer Console comes with few commands by default.

Editor and Development build only:

Logging

Console.Log("hello") to output directly into Developer Console window.

Console.Log("hello", Color.red) with color.

Console.Log("<color=red>hello</color>") with Rich Text color.

By default Unity Debug.Log() or Debug.LogError() messages will also output to Developer Console.

Notes