Visual Studio Code - Unity Code Snippets Error

In Visual Studio Code, most Unity snippets aren’t showing up.

Snippets such as void Start() and void Update() are showing up just fine, however, the Input snippets aren’t functioning.

//When I type in

Input.GetKey(KeyCode.)
//the course lecture says that all possible methods will be shown in a list view.
//That is not happening for me and I have to manually type in

Input.GetKey(KeyCode.Space)

It is not a critical issue, but needs to be addressed and hopefully fixed. I have installed the Unity code snippets that the teacher had instructed us to download in the 4th lecture. If you have a solution, please reply.

Hi,

Please follow the instruction on this website and make sure all required extensions are installed.

And download the .NET Framework 4.7.1 (Developer Pack) from the official Microsoft website and install it. Here is the link:
https://dotnet.microsoft.com/download/dotnet-framework/net471
Maybe you’ll have to reboot your computer. Then launch Unity again and open one of your scripts.

Did this help you fix the problem?


See also:

No, it did not work. Are there any other solutions?

Please share more information on what you did and have in Unity and VS Code. Are there any error messages in your console(s)?

If it’s not working even after installing all the required packages in VS Code then I would suggest you to use Microsoft Visual Studio, from the Microsoft Visual Studio’s installer you can directly install the packages required for unity and you can also install the .NET Framework (Developer Pack) from the installer.

Note – VS Code and Microsoft Visual Studio are different.

I know its not the solution you were asking for but neither I’ve had any idea about this, but Microsoft Visual Studio will get the job done.

I hope it helps :grinning:

Is there any way to install Unity’s snippets onto Visual Studios 2019? Before I started this course, I was using MS Visual Studio Community and I am uncertain if they do have working snippets.

The code is working perfectly fine and there are no console errors or warnings. The only problem is that the snippets aren’t completely working.

Hi guys!

I think I have a solution. The snippets customisation file is stored in a specific folder in Windows. The Unity snippets might be stored in the same folder.
If you operate a Windows device, please go to the following directory in File Explorer;

C:\Users\ your_user \AppData\Roaming\Code\User\snippets

There would be a csharp.json file (hopefully). If there is also a Unity file of any sort, please send that to me as I think it would work.

Yes, there is a way. Just look for the Unity development tools in the Extensions menu.

The package can also be installed during the installation routine.


I looked for the Snippets folder on my harddrive and was not able to find it. Unless I’m wrong, you are looking for IntelliSense in VS Code, not for code snippets. See here:

In Unity, in Window > Package Manager, is the Visual Code Editor package installed? And is VS Code selected as your External Script Editor in Unity (Edit > Preferences > External Tools)?

1 Like

image

Above shows all installed packages in the Unity Package Manager.

I followed all instructions, but it still isn’t working. I even tried uninstalling and reinstalling both programs (VS Code and Unity Hub)

Unity Hub does not have much to do with the Unity Editor.

Which version of Unity do you use?

Maybe consider to give @Pratyush_Jha’s suggestion a try and install Visual Studio.

Version 2021.2.0a10.1508 Personal

I already have Visual Studio Community. Does it need any extensions to work as Visual Studio Code does?

Hey guys, a miracle just happened and everything is working just how it should be!

Thanks for all of your help!

Fantastic!

The “a” in 2021.2.0a10.1508 stands for alpha. Alpha versions are known for being buggy and are not meant to develop an actual game. I would recommend to update or downgrade to a stable version, one with an “f” in its name.

Okay, thank you!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms