Unity/C#

Debug 교체

영스파파 2016. 3. 17. 21:34


using UnityEngine;

using System;



//*

public static class Debug

{

public static bool isDebugBuild = false;


private static string hr = "\n\n-------------------------------------------------------------------------------";


public static void Log(object message)

{

if (isDebugBuild)

UnityEngine.Debug.Log(message + hr);


}

public static void Log(object message, UnityEngine.Object context)

{

if (isDebugBuild)

UnityEngine.Debug.Log(message, context);

}


public static void LogError(object message)

{

if (isDebugBuild)

UnityEngine.Debug.LogError(message);

}


public static void LogError(object message, UnityEngine.Object context)

{

if (isDebugBuild)

UnityEngine.Debug.LogError(message, context);

}


public static void LogWarning(object message)

{

if (isDebugBuild)

UnityEngine.Debug.LogWarning(message.ToString());

}


public static void LogWarning(object message, UnityEngine.Object context)

{

if (isDebugBuild)

UnityEngine.Debug.LogWarning(message.ToString(), context);

}


public static void Assert(bool condition)

{

if (isDebugBuild)

UnityEngine.Debug.Assert(condition);

}


public static void Assert(bool condition, object message)

{

if (isDebugBuild)

UnityEngine.Debug.Assert(condition, message);

}


public static void LogFormat(string format, params object[] args)

{

if (isDebugBuild)

UnityEngine.Debug.LogFormat(format, args);

}


public static void LogErrorFormat(string format, params object[] args)

{

if (isDebugBuild)

UnityEngine.Debug.LogErrorFormat(format, args);

}


public static void LogWarningFormat(string format, params object[] args)

{

if (isDebugBuild)

UnityEngine.Debug.LogWarningFormat(format, args);

}


public static void DrawLine(Vector3 start, Vector3 end, Color color = default(Color), float duration = 0.0f, bool depthTest = true)

{

if (isDebugBuild)

UnityEngine.Debug.DrawLine(start, end, color, duration, depthTest);

}


public static void DrawRay(Vector3 start, Vector3 dir, Color color = default(Color), float duration = 0.0f, bool depthTest = true)

{

if (isDebugBuild)

UnityEngine.Debug.DrawRay(start, dir, color, duration, depthTest);

}


public static void LogException(Exception e)

{

if (isDebugBuild)

UnityEngine.Debug.LogException(e);

}


public static void Break()

{

if (isDebugBuild)

UnityEngine.Debug.Break();

}

}

//*/



Debug.cs