Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Visual studio related issue

Discussion in 'Code Editors & IDEs' started by Right_hand_of_god, Oct 14, 2023.

  1. Right_hand_of_god

    Right_hand_of_god

    Joined:
    Jun 29, 2023
    Posts:
    3
    I've recently been using videos to learn about unity and I've some how seem to have messed my Visual studio up possibly when I was downloading it,
    While coding, certain words I can't expand and open classes and it doesn't recognize and highlight any objects or component names while I'm scripting so I'd love to know how to fix this, and what I did wrong. I've read that it might be because I set up my visual studio up wrong so if anyone has knowledge of how they set theirs up I'd love to hear it so I can follow along with these videos properly.

    Image for example of something I can't do but others can. (the entire drop down box and the green words)
    image_2023-10-14_233005056.png
    and this is mine, no highlight or anything as if its like just a random variable.
    image_2023-10-14_233201174.png
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    4,992
    Nah, you cannot mess it up while downloading or installing - that would make the install fail. Generally, VS is ripe with issues such as these. Intellisense breaking is among the most common, you should fine some tips if you search for „unity visual studio intellisense broken“.

    There are of course other possible issues. What you see may also happen if you open just the script file, rather than the Visual Studio solution (.sln file in the project root). If you double click a .cs script inside the editor it should open the solution. But if you doubleclick the .cs file in explorer this will open just the script, and thus VS cannot make sense of external references.

    Or generating the .sln and .csproj files may be incomplete. Check Preferences => External Tools to make sure VS is set as the script editor and try clicking „regenerate project files“.

    And be sure to use the VS version bundled with Unity. This is the first item if you install Unity via the Unity Hub (recommended).
     
    Right_hand_of_god likes this.