Unity Scripts edited in Visual studio don't provide autocomplete

前端 未结 26 1489
半阙折子戏
半阙折子戏 2020-11-22 10:02

When I want to edit C# Unity scripts, they open in Visual Studio. It is supposed to provide auto complete for all Unity related code, but it doesn\'t work.

Here you c

相关标签:
26条回答
  • 2020-11-22 10:15
    • Go to Options on the Tools menu and then select Documents in the Environment node. (If Documents does not appear in the list, select Show all settings in the Options dialog box.)
    • Put a tick on "Miscellaneous files in Solution Explorer" and Click OK. (This option displays the "Miscellaneous Files" node in Solution Explorer. Miscellaneous files are files that are not associated with a project or solution but can appear in Solution Explorer for your convenience if you tick this option.)
    • Locate your file in the Solution Explorer under "Miscellaneous Files". Then drag and drop your file to where it should belong and voila! This will copy the file to where you drop it. You may now safely delete the older file under Miscellaneous Files folder if you wish to do so

    Credits: https://stackoverflow.com/a/47662523/10471480


    In case Scripts folder is not visible:

    • Click on "Show all files" in Solution Explorer
    • Locate the Scripts folder.
    • Right Click on Scripts and select "Include in Project"
    0 讨论(0)
  • 2020-11-22 10:16

    I tried all of these but ended up finding out that I needed to right-click the solution in Solution Explorer and add existing items and find the C# assembly file in Window's Explorer. There seem to be a bazillion different problems that give you this error, this is likely the most simple solution. If you double click on your script from unity, it does not seem to drag the assembly along.

    0 讨论(0)
  • 2020-11-22 10:19

    Try this,

    1. In Unity Editor Go to Menu, Click on Edit -> Preferences -> External Tools -> External Script Editor. Set it to Visual Studio (your installed version of VS).

    2. Now in Menubar go to Edit -> Project Settings -> Player Settings -> Other Settings -> Under Configuration -> Check API Compatibility Level -> Change it to your installed .Net version. In my case I set it to .Net 4.x

    Now if Visual Studio is running already go to Visual Studio, it will ask to reload project. Reload the project. Check if it works, if not close Visual Studio. Now Open cs file from Unity Editor, and now it should work.

    0 讨论(0)
  • 2020-11-22 10:19

    Keep in mind that if you are using the ReSharper tool, it will override the IntelliSense and show it's own. To change that, on VS, go to Extensions -> ReSharper -> Options -> IntelliSense -> General then choose Visual Studio and not ReSharper.

    0 讨论(0)
  • 2020-11-22 10:19

    Before restarting and/or re-installing VS, First try opening any other of your projects to see if Intellisence works, if it does, then issue probably lies with your current project. First, most probable victim would be the NUGET packages with pending updates. To Fix this,

    1. Right click on references
    2. Proceed to Manage NUGET Packages Under NUGET Packages
    3. proceed to updates Install Updates and recheck Intellisence
    0 讨论(0)
  • 2020-11-22 10:20

    Another possible fix:

    1. In the project window, click on the Assets folder
    2. Right click, and Create -> C# Script
    3. Double click that, and wait.

    For some reason, this work.

    0 讨论(0)
提交回复
热议问题