In-Game Debug Console – NGUI Edition

I was tired of not being able to see all of my Debug.Log() outputs when running a build of my game outside of the editor so I wrote this quick Debug Console that dumps all Debug.Log() callbacks to an in-game GUI. This version is hooked up to a NGUI UITextList but you could modify it to use any other system or even a simple GUIText. Enjoy

using UnityEngine;
using System.Collections;

public class DebugConsole : MonoBehaviour {

  public GameObject DebugPanel;
  public UITextList textList;
  public UILabel gameTimer;

  private bool debugEnabled = false;

  void Awake () {
    Application.RegisterLogCallback(Log);
  }
  public void Log(string text, string stackTrace, LogType logType) {
    if(debugEnabled) {
      textList.Add(text);
    }
  }

  void Update () {
    if(Input.GetKeyDown("`") ) {
      debugEnabled = !debugEnabled;
    }
    if(debugEnabled) {
      DebugPanel.SetActive(true);
    } else {
      DebugPanel.SetActive(false);
    }

    GameTimer();
  }

  void GameTimer () {
    if(debugEnabled) {
      gameTimer.text = Time.time.ToString();
    } else {
      return;
    }
  }
}