Skip to content

Instantly share code, notes, and snippets.

@ryo-ma
Created October 12, 2017 08:38
Show Gist options
  • Select an option

  • Save ryo-ma/468182963bc24e7b20e1d6bfc9dd53a0 to your computer and use it in GitHub Desktop.

Select an option

Save ryo-ma/468182963bc24e7b20e1d6bfc9dd53a0 to your computer and use it in GitHub Desktop.
Unity Disable debug log by Debug class override.
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public static class Debug
{
static Debug()
{
Disable();
}
public static void Disable()
{
UnityEngine.Debug.logger.logEnabled = false;
}
public static void Log(object message)
{
UnityEngine.Debug.Log(message);
}
public static void Log(object message, UnityEngine.Object context)
{
UnityEngine.Debug.Log(message, context);
}
public static void LogError(object message)
{
UnityEngine.Debug.LogError(message);
}
public static void DrawLine(Vector3 start, Vector3 end)
{
UnityEngine.Debug.DrawLine(start, end);
}
public static void DrawLine(Vector3 start, Vector3 end, Color color)
{
UnityEngine.Debug.DrawLine(start, end, color);
}
public static void DrawRay(Vector3 start, Vector3 dir, Color color, float duration = 0.0f, bool depthTest = true)
{
UnityEngine.Debug.DrawRay(start, dir, color, duration);
}
public static void LogWarning(object message)
{
UnityEngine.Debug.LogWarning(message);
}
public static void LogWarning(object message, UnityEngine.Object context)
{
UnityEngine.Debug.LogWarning(message, context);
}
public static void LogFormat(string format, params object[] args)
{
UnityEngine.Debug.LogFormat(format, args);
}
public static void LogException(Exception exception)
{
UnityEngine.Debug.LogException(exception);
}
public static void LogException(Exception exception, UnityEngine.Object context)
{
UnityEngine.Debug.LogException(exception, context);
}
public static bool isDebugBuild = UnityEngine.Debug.isDebugBuild;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment