Created
January 22, 2020 05:45
-
-
Save sh1ch/50c1c21453d8ed98ad92907ae5cbbc03 to your computer and use it in GitHub Desktop.
UnityEngine.Debug クラスのラッパークラスのサンプルです。
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
using System; | |
using System.ComponentModel; | |
using System.Diagnostics; | |
using UnityEngine; | |
using UnityEngine.Bindings; | |
using UnityEngine.Internal; | |
namespace UnityEngine | |
{ | |
/// <summary> | |
/// <para><see cref="Debugger"/> Class contains methods that ease debugging while developing a game.</para> | |
/// <para>Provides <see cref="UnityEngine.Debug"/> features that ensure post-build cleanup.</para> | |
/// </summary> | |
public static class Debugger | |
{ | |
#if !ENABLE_DEBUG_MODE | |
private const string CONDITIONAL_TEXT = "UNITY_EDITOR"; | |
#else | |
private const string CONDITIONAL_TEXT = "ENABLE_DEBUG_MODE"; | |
#endif | |
/// <summary> | |
/// Log a message to the Unity Console. | |
/// </summary> | |
/// <param name="message">String or object to be converted to string representation for display.</param> | |
/// <param name="context">Object to which the message applies.</param> | |
[Conditional(CONDITIONAL_TEXT)] | |
public static void Log(object message, Object context) | |
{ | |
UnityEngine.Debug.Log(message, context); | |
} | |
/// <summary> | |
/// Log a message to the Unity Console. | |
/// </summary> | |
/// <param name="message">String or object to be converted to string representation for display.</param> | |
[Conditional(CONDITIONAL_TEXT)] | |
public static void Log(object message) | |
{ | |
UnityEngine.Debug.Log(message); | |
} | |
/// <summary> | |
/// Logs a formatted message to the Unity Console. | |
/// </summary> | |
/// <param name="context">Object to which the message applies.</param> | |
/// <param name="format">A composite format string.</param> | |
/// <param name="args">Format arguments.</param> | |
public static void LogFormat(Object context, string format, params object[] args) | |
{ | |
UnityEngine.Debug.LogFormat(context, format, args); | |
} | |
/// <summary> | |
/// Logs a formatted message to the Unity Console. | |
/// </summary> | |
/// <param name="format">A composite format string.</param> | |
/// <param name="args">Format arguments.</param> | |
public static void LogFormat(string format, params object[] args) | |
{ | |
UnityEngine.Debug.LogFormat(format, args); | |
} | |
/// <summary> | |
/// A variant of Debug.Log that logs an error message to the console. | |
/// </summary> | |
/// <param name="message">String or object to be converted to string representation for display.</param> | |
/// <param name="context">Object to which the message applies.</param> | |
[Conditional(CONDITIONAL_TEXT)] | |
public static void LogError(object message, Object context) | |
{ | |
UnityEngine.Debug.LogError(message, context); | |
} | |
/// <summary> | |
/// A variant of Debug.Log that logs an error message to the console. | |
/// </summary> | |
/// <param name="message">String or object to be converted to string representation for display.</param> | |
[Conditional(CONDITIONAL_TEXT)] | |
public static void LogError(object message) | |
{ | |
UnityEngine.Debug.LogError(message); | |
} | |
/// <summary> | |
/// Logs a formatted error message to the Unity console. | |
/// </summary> | |
/// <param name="context">Object to which the message applies.</param> | |
/// <param name="format">A composite format string.</param> | |
/// <param name="args">Format arguments.</param> | |
[Conditional(CONDITIONAL_TEXT)] | |
public static void LogErrorFormat(Object context, string format, params object[] args) | |
{ | |
UnityEngine.Debug.LogErrorFormat(context, format, args); | |
} | |
/// <summary> | |
/// Logs a formatted error message to the Unity console. | |
/// </summary> | |
/// <param name="format">A composite format string.</param> | |
/// <param name="args">Format arguments.</param> | |
[Conditional(CONDITIONAL_TEXT)] | |
public static void LogErrorFormat(string format, params object[] args) | |
{ | |
UnityEngine.Debug.LogErrorFormat(format, args); | |
} | |
/// <summary> | |
/// A variant of Debug.Log that logs an error message to the console. | |
/// </summary> | |
/// <param name="exception">Runtime Exception.</param> | |
/// <param name="context">Object to which the message applies.</param> | |
[Conditional(CONDITIONAL_TEXT)] | |
public static void LogException(Exception exception, Object context) | |
{ | |
UnityEngine.Debug.LogException(exception, context); | |
} | |
/// <summary> | |
/// A variant of Debug.Log that logs an error message to the console. | |
/// </summary> | |
/// <param name="exception">Runtime Exception.</param> | |
[Conditional(CONDITIONAL_TEXT)] | |
public static void LogException(Exception exception) | |
{ | |
UnityEngine.Debug.LogException(exception); | |
} | |
/// <summary> | |
/// A variant of Debug.Log that logs a warning message to the console. | |
/// </summary> | |
/// <param name="message">String or object to be converted to string representation for display.</param> | |
/// <param name="context">Object to which the message applies.</param> | |
[Conditional(CONDITIONAL_TEXT)] | |
public static void LogWarning(object message, Object context) | |
{ | |
UnityEngine.Debug.LogWarning(message, context); | |
} | |
/// <summary> | |
/// A variant of Debug.Log that logs a warning message to the console. | |
/// </summary> | |
/// <param name="message">String or object to be converted to string representation for display.</param> | |
[Conditional(CONDITIONAL_TEXT)] | |
public static void LogWarning(object message) | |
{ | |
UnityEngine.Debug.LogWarning(message); | |
} | |
/// <summary> | |
/// Logs a formatted warning message to the Unity Console. | |
/// </summary> | |
/// <param name="context">Object to which the message applies.</param> | |
/// <param name="format">A composite format string.</param> | |
/// <param name="args">Format arguments.</param> | |
[Conditional(CONDITIONAL_TEXT)] | |
public static void LogWarningFormat(Object context, string format, params object[] args) | |
{ | |
UnityEngine.Debug.LogWarningFormat(context, format, args); | |
} | |
/// <summary> | |
/// Logs a formatted warning message to the Unity Console. | |
/// </summary> | |
/// <param name="format">A composite format string.</param> | |
/// <param name="args">Format arguments.</param> | |
[Conditional(CONDITIONAL_TEXT)] | |
public static void LogWarningFormat(string format, params object[] args) | |
{ | |
UnityEngine.Debug.LogWarningFormat(format, args); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment