Search Unity

Question Why doesn't the code autocomplete or doesn't give you suggestions?

Discussion in 'Getting Started' started by MYM_Chapa, Dec 7, 2022.

  1. MYM_Chapa

    MYM_Chapa

    Joined:
    Dec 6, 2022
    Posts:
    15
    I was watching different tutorials where they use the same program to program as me (Microsoft Visual Studio) and they autocomplete part of the code and mine don't upload_2022-12-6_21-3-27.png
    (This is a screenshot of the tutorial)
     
  2. RichAllen2023

    RichAllen2023

    Joined:
    Jul 19, 2016
    Posts:
    1,026
    Update your Visual Studio IDE.
     
  3. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    Close Visual Studio. Inside Unity, go to Assets -> Open C# Project. If this doesn't work, close Unity, open your project directory in Windows Explorer and delete any .csproj and .sln files there, along with directories like Library and obj. Reopen the project (it'll take a bit longer than normal as those directories are regenerated) and do the Open C# Project again. Your IDE should have access to the Unity API for Intellisense now.
     
  4. MYM_Chapa

    MYM_Chapa

    Joined:
    Dec 6, 2022
    Posts:
    15
    Could it be because I downloaded Visual Studio from the Microsoft Store?
     
  5. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    No, that'd have nothing to do with it. Did you try the things I suggested?
     
  6. MYM_Chapa

    MYM_Chapa

    Joined:
    Dec 6, 2022
    Posts:
    15
    Yes, I already tried it and only the language was fixed. Visual Studio also gives me this error, do you think it could be that? upload_2022-12-8_17-3-59.png
     
  7. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    Run the visual studio installer, click on "modify" and in the workload selection check "game development for Unity". It should install all that is needed to work with Unity.
     
  8. AngryProgrammer

    AngryProgrammer

    Joined:
    Jun 4, 2019
    Posts:
    490
  9. MYM_Chapa

    MYM_Chapa

    Joined:
    Dec 6, 2022
    Posts:
    15
    I don't have the Visual Studio Installer because i download it from Microsoft Store.
     
  10. MYM_Chapa

    MYM_Chapa

    Joined:
    Dec 6, 2022
    Posts:
    15
  11. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    I'm not familiar with the windows store version, but it should have installed a separate program called "Visual Studio Installer" that lets you configure the installed components. You should have seen that during the first install. Just type it's name in the start menu and it should come up.

    Also, make sure it's Visual Studio Community (the purple one) not Visual Studio Code (the blue one). VS Code support for Unity has been abandoned.

    -- EDIT --
    I just installed it through the store and the setup is identical to the standalone version: it does first install Visual Studio Installer, which manages the actual VS installation.
     
    Last edited: Dec 11, 2022
  12. RichAllen2023

    RichAllen2023

    Joined:
    Jul 19, 2016
    Posts:
    1,026
    Hmm, if VS support for Unity's been abandoned, how do I write code if/when I ever successfully make anything?
     
  13. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    The VS Code extension no longer receives updates but it still works.
     
  14. MYM_Chapa

    MYM_Chapa

    Joined:
    Dec 6, 2022
    Posts:
    15
    Do you install Visual Studio Code or the Visual Studio Community? Also, should i delete it and install it again? And i can't find the Visual Studio Installer
     
  15. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    Community.
     
  16. MYM_Chapa

    MYM_Chapa

    Joined:
    Dec 6, 2022
    Posts:
    15
    I solved my problem, thank you so much to all;D
     
    Neto_Kokku likes this.
  17. The_Jim

    The_Jim

    Joined:
    Feb 20, 2024
    Posts:
    2
    In https://forum.unity.com/threads/intellisense-not-working-with-visual-studio-fix.836599/
    SpinJack said:
    "That didn't work for me... :(

    I already had Visual Studio Code selected as script editor.
    I didn't have any checkboxes selected under "Generate .csproj files for:"
    I added the checkboxes to all of them, but it had no impact when I reopened a script through Unity.

    Unity recognizes that Visual Studio Code is my External Script Editor, but intellisense in Vis Studio Code still does not recognize or provide autocomplete for Unity namespace items.

    Edit: After a bit of searching I found the solution!

    In addition to the steps listed above in this thread, there is also a Visual Studio marketplace addon that I had to install! Install the following free addon extensions from Visual Studio Marketplace. I would've provided links but the Unity Forum marks it as spam.

    Debugger for Unity by Unity Technologies
    For me, the Unity Debugger finally fixed it!

    Two additional optional Unity tools to consider installing:
    Unity Tools by Tobiah Zarlez
    Unity Code Snippets by Kleber Silva


    I installed all of the above, and I'm happy now! :)

    In my case, I just installed Unity and Visual Studio Code for the first time a few days ago and I just didn't know about the extra Unity extensions that I REALLY needed."

    THIS SOLVED MY PROBLEM. ^^