Autocompletion not working for Oncollisionenter and Ontriggerdenter in VS Code

Whenever I type in OnCollision2D in my Collision class, it doesn’t autocomplete. I’ve tried all solution mentioned previously but nothing works.

What OS are you using? I use Linux Pop!OS and I have this same problem all the time. I’ve learned to live without Intellisense.

If you’re using Windows, however, you should not be having issues like this.

My point is: It might be related to your operating system.

Hi Mehul,

Without any additional information about your script editor or anything else, I can only guess. Please follow the instruction on this website and make sure all required extensions are installed: https://code.visualstudio.com/docs/other/unity

I hope this helped. :slight_smile:


See also:

Currently using window 11. But thing is that for methods like transform it is working well but with oncollision it doesn’t auto complete as seen in screenshot.

1 Like

Currently using windows 11 , Vs code x64 1.69.1 , Unity 2021.3.6f1 , .NET framework 4.7.1 developer pack.
Also reinstalled VScode ,repaired .NET framework using dotnet sdk
As i said earlier with methods like transform it is working well but with oncollision it doesn’t auto complete .

Hi there, friend! I’m on Windows 11 too, and I had the same issue. Just download the .NET Framework 4.7.2 Developer Pack, not 4.7.1. He doesn’t tell you to get it in the video, but after I did this, intellisence works great. Also, of course, make sure VS Code is set as your primary external editor.

If that doesn’t work, let me know, and I will be happy to help you troubleshoot.

Hey there thanks for your concern but Issue is not in .NET .
After some research got to know that ,the thing is Vector3, GameObject, Destroy are all staticly typed classes or methods inside classes. Thus intellisense can autocomplete them.

On the other hand, Awake, Start, Update and other ‘unity callbacks’ are not.

To overcome this situation just installed a extension.

Fr Vs code just search
" Unity Code Snippets " in extention menu.
For verification just check the developer from above link.

1 Like

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

Privacy & Terms