Visual Studio 2015 is not auto completing Unity keywords - c#

I've installed Visual Studio 2015 and Visual Studio 2015 Tools for Unity and I had no problem in using Visual Studio as my default editor in Unity, however I've noticed that Unity's keywords and methods do not auto complete, only the VS do.
For example: GetComponent<>, or OnGui() and Input.GetMouseButton, these are specifically from Unity, when I was using MonoDevelop it displayed the available options of methods when I was typing Input.GetMouse... and if I clicked CTRL + Space it auto completed.
I would like to know if is there any way that I can make Visual Studio recognize Unity API.
Since I am new in Unity and C# I don't know if this is a default behavior, if I should set up something to enable this auto complete feature or if something is wrong and it should be working and somehow it is not.
I would appreciate any help.
Thanks in advance.

Import Unity VS Tools' package into unity, open visual studio and use Ctrl-Shift-Q to call Quick MonoBehavior Wizard
Configure Shortcuts: http://unityvs.com/documentation/shortcuts/
Good luck

Related

Can't access classes of Unity

Here, when I open the highlighted script in a Unity Project:
The visual studio opens and there's no solution explorer:
and even if I add it from View tab, there's nothing in it to be accessed or browsed.
Due to this I'm not able to access Unity classes like in this example Vector3 class cannot be accessed which can be noticed as it's not color coded.
How can this problem be solved?
Sometimes your visual studio is out of sync with your Unity. Some methods I used to fix this are:
Greate a new script and delete it
Editor->prefences-> and set your coding application to visual studio 2019 or any other version
you need to update your visual studio to latest update.
if this didn't work out you'll have to change to vs 2022

Autocomplete not working for VSCode with Unity

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.

The Unity Scripts edited in Visual studio don't provide autocomplete...2020

just like the title Unity Scripts edited in Visual studio don't provide autocomplete. i am trying to make a rigid body and as you can see it doesn't recognize it, some help? By the way i can't change the "External script editor" to something else but "open file by extension:
Your installation of Visual Studio is probably missing the Visual Studio Tools for Unity extension.
Try this installation guide: Get started with Visual Studio Tools for Unity
There is a previous forum that provides guidance on this issue which is still relevant in 2021:
Unity Scripts edited in Visual studio don't provide autocomplete
One solution that worked for me that was not in that forum was going to the Solution Explorer tab in Visual Studios. Right click the solution and hit resolve errors. This may fix the issue.

Why won't Visual Studios show me my Unity script?

I need help with Visual Studios. I am new to Unity and Visual Studios, and for some reason, Visual Studios won't show me my script. I created a script, which I just made, so Visual Studios should have showed me a default Unity script, but it shows nothing. I think it has something to do with Mono because that was the issue in the beginning, but I downloaded twice and the install was successful.
You can always look for another text editor:
Atom
Sublime
Notepad++
Then, in Unity, go to Edit > Preferences > External Tools and find External Script Editor (or a similar setting), then change that to your new editor.

Working with Unity3D and Visual Studio 2013

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

Categories

Resources