I have cloned an existing Unity project from git on a new machine, and the source does not include *.sln or *.csproj.
I have also downloaded Visual Studio from Unity Hub, but the editor doesn't work with Unity:
VS doesn't recognize Unity components
Unity doesn't update VS project (new scripts not recognized in VS)
I have selected VS as external tool for Unity, as shown here:
I also installed anything VS suggests (Mono, and a few plugins, etc). What's still missing?
The VS version is 7.7.4 and Unity is 2019.02
Problem fixed when I happened to re-open the project inside Unity:
Asset > Open C# Project
References:
Autocompletion not working in Visual studio
https://answers.unity.com/questions/1451377/autocomplete-in-visual-studio-wont-work-please-hel.html
Related
The question is as title says.
My settings:
Unity version: 2020.3.24f1 (it's the LTS)
VSCode version: 1.63.0
I got some extensions for VS Code: C#, VS IntelliCode (don't think this matters)
Things that I've done:
https://forum.unity.com/threads/cant-get-vscode-to-work-properly-with-unity.538224/
https://forum.unity.com/threads/intellisense-not-working-for-visual-studio-code.812040/
Unity VSCode autocomplete Intellisense not working
Installation issue with Visual Studio using Unity
How to get Visual Studio to recommend unity codes
Unity Scripts edited in Visual studio don't provide autocomplete
VSCode with unity c# autocomplete problem
Unity VSCode Intellisense not working in 2020 version
TL;DR -
I've set Visual Studio Code as my external script editor, tried downloading mono editor + gtk thing, snippet tool is NOT what I want, restarted my computer, and few more that I can't even remember.
Please don't recommend other editors than VS Code because I see so many thread pointing to VS Community 2019 and I just can't see how VS Community solution is relevant to VS Code.
I had the same issue and I solved it randomly so I will tell you the things I tried:
uncheck all options in unity>edit>preferences>external editor>generate .csharp. I checked all of them because a youtuber told me but then I saw that input system and cinemachine namespaces won't work so I unchecked them, now it works, it also helped on autocomplete.
download unitydev extension package from VS Code extensions, this package has all the needed documents and snippets and autocomplete assets.
try to regenerate files and reset argument, change editor to something else and see if it won't work there too!
most important: downgrade vscodes pakcage in unity package manager. I think I used 1.2.0 and it worked.
I am new to unity and have recently started scripting, I noticed that my vscode 2020 doesn't autocomplete my c# scripts.
I have the c# extension installed
I have "Visual Studio Code" selected in the preferences in unity
I tried a bunch of different extensions
I tried to Regenerate Project Files With Different Checkbox Selected
but nothing works.
Then I downloaded 2019 version of vscode. Surprisingly, intellisense is working in vscode 2019, however it isn't in 2020.
What shall I do?
Any help will be appreciated.
If you want to use Visual Studio with maximum compatibility with Unity, install through the Unity Hub. (open the Unity Hub, go to the installations, three points, add modules, click on Visual Studio Community 2019 and install it)
It will install Visual Studio Community 2019 with its Unity package, also in the project's Package Manager you can download, if it is not already installed, the support package that Unity (Visual Studio Editor) updates regularly, and which guarantees compatibility with Unity.
If you want to use only Visual Studio Code instead, I don't know what to say, not being installable through Unity Hub I think the support is less, you can still try to install the package (Visual Studio Code Editor) in the package manager and see if it solves the problem.
Every time I try to open a C# Script inside Unity, it immediately hangs and doesn't even open Visual Studio, this started happening after I updated Visual Studio 2017 twice, the first one was an incomplete installation since my computer restarted then the second one was completed version.
Unity still works normally for all things except opening a C# script. I tried changing the External Tools Preferences in the Edit between Visual Studio 2017 and Visual Studio 2017 (Community) but both did nothing.
When Unity hangs, I can only use Task Manager to close it and MonoDevelop isn't one of the options in the External Tools Preferences
Can you open Visual Studio when Unity is not open? Which version of Unity are you using for your project? Are you using Unity Hub to manage your versions?
Steps to try:
Reinstall VS (update to 2019 optional)
Close all background services related to VS and Unity.
If all else fails, you can clean the registry before reinstalling.
Uninstall both Unity, VS and any dependency that you have installed. Then go to Hub and download your required version with all the required dependencies.
Doing this will remove any inconsistency and also you will not have to do the external tool reference yourself.
Since updating to the most recent version of Unity 5.4.0f3, whenever I doubleclick on a script, it launches both Visual Studio and Monodevelop, but I get an error saying that the this version of VS (Community 2015) is unable to open my project. Monodevelop displays it's own, somewhat less clear error message. Please see the screen shots below.
I can still manually open my script using Visual Studio's file menu, but the intellisense code completion no longer works. Anyone know how to fix this? I have Visual Studio's Tools for Unity installed.
I was having similar issues when doing a clean download of an existing Unity project onto a fresh install of Visual Studio Community 2019.
In the end the issue for me was that, although the correct version of VS Tools for Unity was installed, it was 'Disabled' by default in VS's Manage Extensions dialog (Extensions -> Manage Extensions). Just had to click 'Enable', restart Visual Studio, and all worked as expected again.
Turns out it was an issue with my existing install of Visual Studio Tools for Unity (VSTU).
I found a thread where users had experienced similar problems due to an unsupported version of VSTU running on Unity5.2 and beyond. Unity 5.2+ requires VSTU 2.1 or later for VS to work correctly with Unity, more information for anyone interested is available in the documentation here.
I had VSTU 2.3 installed, but removing and reinstalling VSTU resolved the issue, so there must have been a problem with my install. If anyone else has this or a similar issue you can download the latest installer for VSTU here. Thanks to all who chimed in your responses helped me look in the right place!
Please try following steps:
Delete old *.csproj and *.sln files on project's root folder
Check "Edit > Preferences > External Tools" and make sure you've selected "Visual Studio"
Re-open solution by "Assets > Open C# Project" menu
For me it was enough to right click the solution in Solution Explorer and run "Resolve errors".
I will complete what is said above. I experienced this issue today and it took me a while. In my case it was relative to a new install of the Unity Editor.
For some unknown reason the unity tool used on VS (intellisense) was uninstalled. I had to reinstall this : open Visual Studio Installer, select your project and reach the Gaming section where reside the tool for Unity.
The extension "Visual Studio 2019 Tools for Unity" seems no longer available for download via the extension manager. Luckily I recalled that I saw some game development features in the Visual Studio installer, so I picked that one:
It works for VS 2019 (16.11.11) and VS 2022 (17.2.0 Preview 1).
how do i get Unity3D for debugging the code, and Visual Studio 2013 which i have now to only script the code. Example: Like Flash Professional for debugging and FlashDevelop for scripting only.
My question is, how do i get the Unity3D link with Visual Studio 2013. I already searching around the internet, and had found that Unity3D only works with VisualStudio 2010.
I wrote a blog article on this awhile back on my blog HERE for Visual Studio.
However I will paste it here too:
How to use Visual Studio 2013
Recently Microsoft bought and re-released the popular Unity3D plugin UnityVS. The now renamed Visual Studio Tools for Unity plugin smooths the connection between Unity and Visual Studio and even allows one to perform debugging too! Download it here.
In Unity Editor go to Edit->Preferences->External Tools and In External Script Editor choose Browse from the drop down box.
Browse to and select C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe.
The External Script Editor should automatically show your selected editor as Visual Studio 2013.
That’s it! It should just work from that point on.
As an important update, I would like to notice, that former UnityVS (after Microsoft's acquisition of SyntaxTree) is now available for free as a rebranded Visual Studio 2013 Tools for Unity.
The versions for VS 2012 and VS 2010 are also available.
The integration of Unity3d and Visual Studio got simpler with latest Unity (version 5) and Visual Studio Tools. This is the current procedure.
To use Visual Studio as editor and debugger with Unity you must:
Install the Visual Studio Tools For Unity. For this download the package at http://unityvs.com (careful to get the version for the Visual Studio you are using) and import it (as is standard in Unity for packages) by going into Assets -> Import Package -> Custom Package and browse to the tools installation folder and pick the package.
Once installed in Unity you will get an additional menu Visual Studio Tools, go there and select "generate project files". Visual Studio will already be the default editor for your scripts.
This done, if you say put a breakpoint in Visual Studio, click on "Attach to Unity" in Visual Studio, and then run your Unity project, the process will stop at breakpoints in Visual Studio and allow variable inspection etc.
you can use unityvs VS plugin (but I'm not sure about current 2013 support, it's works with vs2012) http://unityvs.com/ - on windows it's works very well, but remote OSX debugging feature is not ready yet
I'd like to add to the fine answer given by Pietro Polsinelli, that for me, there was an extra step in his Step 1. And that is that, after installing Visual Studio Tools For Unity, I had to, in Unity, go to Assets->Import Package->Visual Studio 201X Tools and then click around on the menu bar until "Visual Studio Tools" showed up as an option. After that, I could Generate Project Files and Open in Visual Studio.
This enabled me to Attach to Unity in Visual Studio and debug.
None of these solutions worked for me. Renaming monodevelop just changed the default program to notepad++, and the next default program after that was simply notepad.
However, there is a known bug with Visual Studio 2013 (not sure if it was present in previous versions, or if it is present in the non-professional version) where if you try to open a C# file in visual studio, where Visual Studio is opened as administrator and Unity isn't, VS crashes.
I had to either run both programs (VS and Unity) as administrator, or not open VS as administrator (as per the solution found here: http://connect.microsoft.com/VisualStudio/feedback/details/597863/cannot-open-visual-studio-files-from-windows-explorer).
With Visual Studio You Can Use UnityVS Plugin But if You Use Monodevelop You Can Go To Run->Attach To Process.. And Connect The Debugger to Unity Editor It Work Perfectly.
To link Unity with Visual Studio, do the following:
Do this on Unity.
Go to file --> preferences --> external tools --> external script editor --> Choose visual studio.
If Visual Studio is not showing, you Re gonna have to browse Visual Studio by hand.
Then you open any script in the Unity Project window and Visual Studio should open the file.
I hope this is helpful.
Note that I am using Unity 2020.2 and Visual Studio 2019