Search Unity

Missing an assembly reference for System.dll in Unity project

Discussion in 'Scripting' started by unity_CtdgKg5fjfyL4w, Mar 2, 2018.

  1. unity_CtdgKg5fjfyL4w

    unity_CtdgKg5fjfyL4w

    Joined:
    Mar 2, 2018
    Posts:
    1
    Hi, I'm new to Unity and would like to debug some of the third party libraries that I use in my project. All these dlls use System.Diagnostics.Debug method for logging and don't print any logs on VS output console. I tried to override the logging mechanism by registering custom logger, but I got the following error:
    The type or namespace name 'TraceListener' does not exist in the namespace 'System.Diagnostics' (are you missing an assembly reference?)

    public class UnityLogger : System.Diagnostics.TraceListener
    {
    private static UnityLogger instance = new UnityLogger();
    private UnityLogger()
    {
    System.Diagnostics.Debug.Listeners.Add(instance);
    }
    public static UnityLogger getInstance()
    {
    return instance;
    }
    public override void WriteLine(string message)
    {
    Debug.Log(message);
    }
    public override void Write(string message)
    {
    WriteLine(message);
    }

    Is it possible to use VS dependencies while building Unity project or is there any other way to fix it? It looks like System.dll for Unity is a bit different and doesn't contain some classes. I also tried to import System.dll for .NET manually, but it resulted error due to duplicated dependencies.

    I'm using Unity 5.6.3 and VS 2015 update 3.