-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGDebug.cs
155 lines (142 loc) · 6.13 KB
/
GDebug.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
using UnityEngine;
using System;
namespace Utility{
class GDebug{
static bool DEBUGMODE = true;
/// <summary>
/// Logs a message to the Unity Console if debug mode is enabled.
/// </summary>
/// <param name="message"> String or object to be converted to string representation for display.</param>
public static void Log(string message){
if (DEBUGMODE)
{
Debug.Log(message);
}
}
/// <summary>
/// Logs a message to the Unity Console if debug mode is enabled.
/// </summary>
/// <param name="message"> String or object to be converted to string representation for display.</param>
/// <param name="obj">Object to which the message applies.</param>
public static void Log(string message, UnityEngine.Object obj){
if(DEBUGMODE){
Debug.Log(message, obj);
}
}
/// <summary>
/// Logs a message to the Unity Console if debug mode is enabled.
/// </summary>
/// <param name="message">String or object to be converted to string representation for display.</param>
/// <param name="className">Name of object who sent the message log.</param>
/// <param name="functionName">Name of function who sent the message log.</param>
public static void Log(string message, string className, string functionName)
{
if (DEBUGMODE)
{
Debug.Log(className + "::" + functionName + "() // " + message);
}
}
/// <summary>
/// Logs a message to the Unity Console if debug mode is enabled
/// </summary>
/// <param name="message">String or object to be converted to string representation for display.</param>
/// <param name="classObject">Object who sent the message log.</param>
/// <param name="functionName">Name of Function who sent the message log.</param>
public static void Log(string message, UnityEngine.Object classObject, string functionName){
if(DEBUGMODE){
Debug.Log(classObject.GetType().Name + "::" + functionName + "() // " + message);
}
}
/// <summary>
/// Logs an error message to the Unity Console if debug mode is enabled.
/// </summary>
/// <param name="message"> String or object to be converted to string representation for display.</param>
public static void LogError(string message){
if(DEBUGMODE){
Debug.LogError(message);
}
}
/// <summary>
/// Logs an error message to the Unity Console if debug mode is enabled.
/// </summary>
/// <param name="message"> String or object to be converted to string representation for display.</param>
/// <param name="obj">Object to which the message applies.</param>
public static void LogError(string message, UnityEngine.Object obj){
if(DEBUGMODE){
Debug.LogError(message, obj);
}
}
/// <summary>
/// Logs an Error message to the Unity Console if debug mode is enabled
/// </summary>
/// <param name="message">String or object to be converted to string representation for display.</param>
/// <param name="classObject">Object who sent the message log.</param>
/// <param name="functionName">Name of Function who sent the message log.</param>
public static void LogError(string message, UnityEngine.Object classObject, string functionName){
if(DEBUGMODE){
Debug.LogError(classObject.GetType().Name + "::" + functionName + "() // " + message);
}
}
/// <summary>
/// Logs an error message to the Unity Console if debug mode is enabled.
/// </summary>
/// <param name="message">String or object to be converted to string representation for display.</param>
/// <param name="className">Name of object who sent the message log.</param>
/// <param name="functionName">Name of function who sent the message log.</param>
public static void LogError(string message, string className, string functionName){
if(DEBUGMODE){
Debug.LogError(className + "::" + functionName + "() // " + message) ;
}
}
/// <summary>
/// Logs a warning message to the Unity Console if debug mode is enabled.
/// </summary>
/// <param name="message">String or object to be converted to string representation for display.</param>
/// <param name="className">Name of object who sent the message log.</param>
/// <param name="functionName">Name of function who sent the message log.</param>
public static void LogWarning(string message){
if(DEBUGMODE){
Debug.LogWarning(message);
}
}
/// <summary>
/// Logs a warning message to the Unity Console if debug mode is enabled.
/// </summary>
/// <param name="message"> String or object to be converted to string representation for display.</param>
/// <param name="obj">Object to which the message applies.</param>
public static void LogWarning(string message, UnityEngine.Object obj){
if(DEBUGMODE){
Debug.LogWarning(message, obj);
}
}
/// <summary>
/// Logs a warning message to the Unity Console if debug mode is enabled
/// </summary>
/// <param name="message">String or object to be converted to string representation for display.</param>
/// <param name="classObject">Object who sent the message log.</param>
/// <param name="functionName">Name of Function who sent the message log.</param>
public static void LogWarning(string message, UnityEngine.Object classObject, string functionName){
if(DEBUGMODE){
Debug.LogWarning(classObject.GetType().Name + "::" + functionName + "() // " + message);
}
}
/// <summary>
/// Logs a warning message to the Unity Console if debug mode is enabled.
/// </summary>
/// <param name="message">String or object to be converted to string representation for display.</param>
/// <param name="className">Name of object who sent the message log.</param>
/// <param name="functionName">Name of function who sent the message log.</param>
public static void LogWarning(string message, string className, string functionName){
if(DEBUGMODE){
Debug.LogWarning(className + "::" + functionName + "() // " + message);
}
}
#region VisualGizmos
public static void DrawRay(Vector3 start, Vector3 dir, Color color){
if(DEBUGMODE){
Debug.DrawRay(start, dir, color);
}
}
#endregion
}
}