'Changing the default tag in Debug.Log for Unity 3D
In order to debug the code for android tags are very helpful to filters the logs on the basis of tags. In Unity 3d when we use
Debug.Log
By defaults all logs have Unity as tag, is there any way to change this default tag?
Solution 1:[1]
Nope there're no way to change the tag(as far as I've seen). As mentioned here.
You can however display the log as either error, warning or a normal debug message. Check the Debug
class for that.
Solution 2:[2]
You can now use a logger instead:
private static ILogger logger = Debug.unityLogger;
private static string kTag = "MyTag";
private void MyMethod() {
logger.logError(kTag, "Error message");
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | noob |
Solution 2 | babibo |