Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Visual Studio turn off auto using

Discussion in 'Entity Component System' started by iamarugin, Jun 4, 2020.

  1. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    880
    I am using Visual Studio 2019 with Unity. When I am working with DOTS and start typing Debug.Log VS automatically adding

    using System.Diagnostics;

    on top of the file. After that I should manually remove this line and then type

    using UnityEngine;

    to use Debug.Log from UnityEngine.

    This is very annoying. How to turn off this behaviour?
     
  2. ZyderNarfall

    ZyderNarfall

    Joined:
    Jun 11, 2020
    Posts:
    8
    I’m having the same problem.
    I’m still looking into it.
     
  3. John_MSFT

    John_MSFT

    Microsoft Employee

    Joined:
    Feb 21, 2018
    Posts:
    118
    @iamarugin @ZyderNarfall

    Hey, Program Manager of Visual Studio Tools for Unity here. It seems this setting might be getting in the way:

    upload_2020-7-17_13-43-56.png

    Try disabling (Visual Studio > Tools > Options > C# > IntelliSense > Show items from unimported namespaces) that and see if it's less annoying. In the meantime, I'll add an item to our backlog to see if we can be smarter about this.
     
    jefferyankrom likes this.
  4. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,112
    i fixed it by removing Unity, Unity Hub & Visual Studio completely from pc then i reinstalled them.
    20 minutes of pure pain but it works.
     
  5. John_MSFT

    John_MSFT

    Microsoft Employee

    Joined:
    Feb 21, 2018
    Posts:
    118
    Yikes! I suggest anyone who runs into a similar problem try my solution first. I don't know what re-installing would do / reconfigure to default here, but it's certainly way more pain than necessary.
     
    Opeth001 likes this.
  6. ZyderNarfall

    ZyderNarfall

    Joined:
    Jun 11, 2020
    Posts:
    8
    Ok, so what fixed it for me was Edit > Preferences > External Tools > External Script Editor (Select the version of Visual Studio you are using) or browse for the Software you want to use.
    https://forum.unity.com/threads/using-system-diagnostics-c-code-auto-fill.930621/#post-6089229
    The person on my thread answered it as well.

    I do not claim to own or nor do I have anything to do with the video. It just helped me.
    This is the video if you need it as well.
    This is what fixed it for me.
     
  7. legionair4

    legionair4

    Joined:
    Jul 27, 2019
    Posts:
    1
    Not sure if this will work for everyone or if it is appropriate but this was the closest forum I could find. I found the solution to this for my problem at Here. It was to do with an extension in Visual studio code called Auto-Using for c#. After I disabled this extension and reloaded the visual studio code editor it fixed my problem.