OnCollision2D doesn't autocomplete/work

Hi! I’m on the OnCollision2D Lecture of the Delivery Driver C# Course.
Whenever I type in OnCollision2D in my Collision class, it doesn’t autocomplete, making me feel like something is wrong, and it also just doesn’t seem to work in my project. No message gets logged. Any suggestions as to what I might be doing wrong?

Here is the no auto-complete:

And here is how I had it after manually typing it in:
eO7

Please let me know if anyone has any suggestions on how to resolve this, or if you need more information.

Thanks!

Hi CadeMH,

Welcome to our community! :slight_smile:

You probably didn’t do anything wrong. There seems to be an issue with VS Code.

Please follow the instruction on this website and make sure all required extensions are installed: https://code.visualstudio.com/docs/other/unity

If the issue persists, please check the console of VS Code (not Unity!). If the .NET Framework 4.7.1 (Developer Pack) is mentioned there, download and install it from the official Microsoft. Here is the link: https://dotnet.microsoft.com/download/dotnet-framework/net471

Depending on your version of Unity, it might be that you will have to install the “Visual Studio Code Editor” package in Window > Package Manager in Unity.

  1. Press Ctrl + Shift + P.
  2. Type “OmniSharp: Select Project” and press Return.
  3. Select the solution workspace entry.

Maybe you’ll have to reboot your computer. Then launch Unity again and open one of your scripts.

Did this help?


See also:

Hi Nina,

That solved my issues. Thank you very much!

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

Privacy & Terms