When i program scripts for unity via Visual Studio, no code complete appears for unity functions. also, no errors appear when i, say, forget a semicolon or something.
i tried reinstalling the vs unity plugin, no change.
You can try the following steps to solve the problem:
Close visual studio.
Go to Edit < Preferences < External Tools in unity.
Change the External Script Editor like this:
Try again in the visual studio.
Related
I work with unity and the VS code autocomplete does not complete many unity objects and more..
I have 2 extensions on my VS:
1.C# for Visual Studio Code (powered by OmniSharp).
2.Unity Code Snippets.
I'm using windows 10 and I looking for answers on the web for weeks, I tried to play with the settings, open new projects, reinstall VS CODE and nothing happen.
also I saw that it's happen mostly to people with an old version of Unity but it's not my case..
I work with unity version 2021.1.15f1 personal and VSCODE 1.59.1
This is a picture that illustrates the situation
Apologies if you've tried everything there already, but following the instructions at this link have helped me get auto-complete for Unity set up in VS Code when I got started: https://code.visualstudio.com/docs/other/unity
One key aspect that I had missed originally was the Unity Script Editor set up section. IntelliSense only starts working after you have opened a script via the Unity Editor rather than straight in VS Code. It generates an Assembly-CSharp.csproj file at the root which is necessary for enabling the functionality.
Make sure that Visual Studio Code is selected as the default "External Script Editor" in your Unity preferences.
To do that in Unity, go to Edit->Preferences and then select "Visual Studio Code" as your preferred external script editor. Restart VSC afterwards.
I recently installed unity ,but I didn't install visual studio with it because I already have installed.
I simply opened unity and I goes to Edit > Preferences > External script editor and I selected Visual studio code . But when I opening my scripts, visual studio not giving hints for my c# code.
You probably need to install the appropriate targeting pack for Unity. That article also has some other helpful extensions to install when developing in Unity.
What you could do is just open it and close it.
What i mean by that is go to Assets > Open C# Project
Once VSCode opened, wait for 1 min, try to write something like Rigidbody.
If intellisense is working it will start giving you hints, if it's still not working
Do the process one more time,
You can refer to these pictures where how VSCode tells you whether Intellisense is working or not.
http://imgur.com/gallery/1YiuPA4
You need to install snippets for Unity in VS code.
Open VS code. Go to Extensions(ctrl+shift+X).
In search field you need to write unity
Then click to Unity Code Snippets and install it in window bellow.
Then you will be able to see Intelesence !
I recently came back to unity, as i found out that it does now support installation linux. It works, but when editing the scripts with vscode i do not get code completion.
I have installed the C# extension, the Debugger for unity extension and the Unity Code Snippets extension.
I know that there is the Visual Studio IntelliCode extension, but this does only support Java, Python js and ts. I also know that there are IDEs that i can use, like Rider, but i would like to setup this in a lightweight environment without an IDE.
So, how do i setup code completion in vscode for unity-scripts on linux?
Have you tried this guide
Install Unity Editor
Install Visual Studio Code
3.Tell Unity to use VSCode
n project preferences -> external tools you can tell Unity what program to use for editing c# scripts. If you have the Visual Studio Editor packages in your project, you should see a special “Visual Studio Code” option in your preferences. The packages are part of the standard Unity download now.
Install dotnet
Install mono-complete
Most people forget step 3
I tried everything in the installation guide, but code completion would still not work.
Somewhere I read that setting Use Global Mono to always in the C# extension for VS Code might fix the problem. So I did that, restarted Unity, Unity Hub and VS Code, and then it started working correctly.
I just heard that Unity will be dropping support on MonoDevelop on its 2018.1 version and went to search for an alternative. VSCode was the best option so I downloaded it and installed all suggested Unity extensions. (https://code.visualstudio.com/docs/other/unity)
I also changed my External Script Editor to Code. I've created a new Unity project for testing. The code snippets are working great for unity methods such as Start () and Update () but whenever I try to declare a variable like:
private Rigidbody rb;
The rigid body is not suggested. I decided to test with other data types, the most essentials like int, float, etc. And none of them are suggested either. What could be happening? Why is IntelliSense not working properly? I've already downloaded the C# extension as suggested at https://code.visualstudio.com/docs/editor/intellisense
I'm on a Mac using MacOS Sierra with the most current version of VSCode and Unity 2017.1.
[EDIT] The problem was solved after I reinstalled, MonoDevelop, VisualStudio for Mac, VSCode and all it's extensions and used mad.meesh suggestion of searching the .sln on project opening. I still don't understand why, but it's working.
Old question, but I had the same problem just recently.
There must have been an issue in your Assembly-CSharp.csproj or project-name.sln files. Most likely to be the .csproj file. If you take a look at it, you will see various references to .dll files.
You can tell Unity (my version: v2019.2.20f1) to create these for you by enabling Edit > Preferences > Generate all .csproj files.
Delete both files.
Enable .csproj file generation.
Double click on a script in Unity.
This fixed my issue.
I followed the tutorial from Microsoft for VS Code with Unity and it seemed to finally do the trick... https://code.visualstudio.com/docs/other/unity
Steps I took:
Installed https://dotnet.microsoft.com/download
Installed https://www.mono-project.com/download/stable/
Installed C# extension in VS Code.
Unity > Preferences (cmd + , on Mac) > External Tools (left toolbar) > External Script Editor > Visual Studio Code.
Then this is the trick I found to work after doing all of this... I open up VS Code prior to starting my Unity Project and manually go into the Unity Project folder and open up everything in VS Code FIRST. Then, with that project already open and working in VS Code with Intellisense, I double click the script in Unity and it will open it up in the already opened VS Code editor and have Intellisense already working! Do my normal workflow for the day and close everything down... then when I start up the next time, just be sure to open the project in VS Code FIRST and then VS Code will recognize it's a C# project and initiate Intellisense and all that jazz.
Hope this helps!
It does not get any deeper than this. If i double-click on a script in Unity, or double-click on an error line in the console it brings up a new Visual Studio window instead of showing the error/script in the already open solution. :/
If you want to use the Visual Studio with Unity, I recommend you to use the unityVS, a plugin who makes integration with Visual Studio and Unity. So you can debug with Visual Studio, and more. It's free!
http://unityvs.com/
OK, I restarted unity and it fixed it, also, I'm not sure if this mattered but I unchecked Editor > Preferences > External Tools > Editor Attaching, but I think a simple restart would make it anyways.