*Can't add script* error!

I’ve just started this course and on the very first code on Unity (“Hello World”), I keep getting this error. I’ve created many projects and also checked that my classname & filename match. Still the error doesn’t go. There’s not even a compilation error as it is just a one liner code (also it is with a semicolon (;)). Also I’ve updated versions of both Unity and Visual Studio. Also in Unity, in External Tools, Visual Studio is selected. Tried all sorts of solutions. Help please

Hi Rhythm,

Welcome to our community! :slight_smile:

Have you already tried to restart Unity and VS? If so, please try the following suggestions:

  1. Restart Unity and VS.
  2. Is Visual Studio selected as your External Script Editor in Unity (Edit > Preferences > External Tools)?
  3. Are the Unity development tools installed in VS (Tools > Extensions and Updates)? If they are not installed, go to Tools > Get Tools and Features.
  4. Please check if your scripts are included in the project in Visual Studio. Open the Solution Explorer with Ctrl + Alt + L. A dotted icon indicates that the object is not included. If that’s the case, do the following:

  1. Reboot your PC.
  2. Close both Unity and VS. Go to your project folder and delete all sln and csproj files. Then start Unity again, double click on the script file inside your Assets folder in Unity.
  3. Try to update VS.
  4. Try to update Unity.

Did any of these fix the issue for you?

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

Privacy & Terms