Last active
March 5, 2021 17:44
-
-
Save rubit0/daf609038b139f3848e7b1c39b74b1ea to your computer and use it in GitHub Desktop.
Debug build only debug logging.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class DevDebug | |
{ | |
[Conditional("UNITY_EDITOR")] | |
[Conditional("DEBUG")] | |
public static void Log(string message, UnityEngine.Object context = null) | |
{ | |
if (context != null) | |
{ | |
Debug.Log(message, context); | |
} | |
else | |
{ | |
Debug.Log(message); | |
} | |
} | |
[Conditional("UNITY_EDITOR")] | |
[Conditional("DEBUG")] | |
public static void LogWarning(string message, UnityEngine.Object context = null) | |
{ | |
if (context != null) | |
{ | |
Debug.LogWarning(message, context); | |
} | |
else | |
{ | |
Debug.LogWarning(message); | |
} | |
} | |
[Conditional("UNITY_EDITOR")] | |
[Conditional("DEBUG")] | |
public static void LogError(string message, UnityEngine.Object context = null) | |
{ | |
if (context != null) | |
{ | |
Debug.LogError(message, context); | |
} | |
else | |
{ | |
Debug.LogError(message); | |
} | |
} | |
[Conditional("UNITY_EDITOR")] | |
[Conditional("DEBUG")] | |
public static void LogException(Exception ex, UnityEngine.Object context = null) | |
{ | |
if (context != null) | |
{ | |
Debug.LogException(ex, context); | |
} | |
else | |
{ | |
Debug.LogException(ex); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment