Search Unity

Visual studio not loading non-default namespaces

Discussion in 'Code Editors & IDEs' started by UnityMagics, May 6, 2020.

  1. UnityMagics

    UnityMagics

    Joined:
    Jun 23, 2018
    Posts:
    2
    So i ran into this problem with visual studio community where it can't find some namespaces. Game runs perfectly without console errors.
    Edit1: Old projects show TMPro properly.

    I have tried (in order):
    • Relaunch Unity & Visual studio
    • Reboot
    • Reinstall mirror from asset store
    • Reinstall Visual studio community
    • Update Visual studio community to 2019 version
    • (found this step in forums) In unity:
      • preferences -> external tools -> regenerate project files




    Lead?
    Unticking everything in Project -> Add reference and then clicking ok, going back to Project -> Add reference reticking all of them again and clicking ok fixed this for me.
    Edit. After few minutes it stopped working again.
     

    Attached Files:

    Last edited: May 7, 2020
  2. UnityMagics

    UnityMagics

    Joined:
    Jun 23, 2018
    Posts:
    2
    This happened to me again after pressing some key combination in the editor. (something along ctrl + r + r)

    Editor can find default unity packages just fine but can't find imported one, such as TMRPO in this case.
     
    ROBYER1 likes this.
  3. irvfrost

    irvfrost

    Joined:
    Sep 20, 2012
    Posts:
    1
    I'm having the same issue now on one machine. I had to reset windows, then reinstall everything. Added Community 2019, added the unity version I work in for this project 2019.3.5f1 restored the project from my SVN and now this machine does not recognize Mirror in VS. Mirror is up to date. The project works fine on the laptop I use when away from the office it has community 2019 as well. Anyone have a fix?
     
  4. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    Having this issue too, think I accidentally pressed a shortcut when coding.. is there an easy fix or a keyboard shortcut?
     
  5. Valkiden

    Valkiden

    Joined:
    Jun 27, 2017
    Posts:
    1
    No permanent fix yet.

    However, I fix this by removing the reference to 'Mirror' (or whatever project) under 'Assembly-CSharp', and then re-adding it. This works until I have to re load changes from the editor.
     
    torinikukfc likes this.
  6. wRadion

    wRadion

    Joined:
    May 22, 2018
    Posts:
    1
    I'm having this issue with the package Mirror with Visual Studio Community 2019 as well as Visual Studio Code.
    Is there any fix for this?
    I'm using Unity 2020.1.11f1. I'll try to use Unity 2019 instead right now and will keep you updated.

    EDIT: I'm having other issues by switching to Unity 2019 so I'm switching back to Unity 2020

    EDIT2: I found a potential fix; into Unity, go to Edit > Preferences > External Tools, I checked every checkbox in "Generate .csproj files for", clicked on "Regenerate project files" then launched the Visual Studio Community C# project. It imported all projects (I had 58 which is way too much). Then I just unchecked the boxes (except Local Packages) and restarted Visual Studio and everything works correctly now.
     
    Last edited: Nov 3, 2020
  7. EggnoggOfEgg

    EggnoggOfEgg

    Joined:
    Jan 23, 2021
    Posts:
    5
    thanks a million this worked
    Thanks a million this worked for me. Will post any updates if there are problems.
     
  8. sranciato1

    sranciato1

    Joined:
    Jan 11, 2020
    Posts:
    1
    Thank you! This worked for me as well!

     
  9. WriterBrandy

    WriterBrandy

    Joined:
    Apr 4, 2020
    Posts:
    2
    Sadly, it did not work for me. I am still having issues getting Visual Studio to recognize Mirror.
     
  10. benio33

    benio33

    Joined:
    Jul 22, 2016
    Posts:
    3
    Thank you - it worked.

    WriterBrandy - make sure you have VS closed when "Regenerating project files" otherwise it's trying to modify opened files and errors out.
     
  11. jijameschoi

    jijameschoi

    Joined:
    Jul 11, 2021
    Posts:
    1
    My goodness, thank you. This worked out.
     
  12. Bleskar

    Bleskar

    Joined:
    Mar 16, 2020
    Posts:
    1
    For me, it worked just to click "regenerate project files", i didnt need to check and uncheck all those boxes, but thanks anyways for the help!
     
    AlharbiSunds likes this.