Search code examples
visual-studiounity-game-engine

Visual Studio not recognizing unity things, and not showing unity C# autocomplete


I installed unity and Visual Studio on my computer to start working on games again, however when editing code it does not autocomplete properly and it does not recognize Unity exclusive stuff.

Screenshots:

enter image description here

enter image description here

enter image description here

I have tried:

  • Setting Visual Studio as the editor in the external tools section
  • Downloaded both the Unity Dev kit and the .NET kit for Visual Studio
  • Made it generate .csproj files for everything, and regenerated project files
  • Reimported all assets
  • Deleted .sln (no errors popped up)

Solution

  • Autosuggestion is based on the namespaces your file references. InputAction is part of Unity.InputSystem namespace

    Add to the namespaces declaration

    using Unity.InputSystem;
    

    Also if you type class name completely, quick actions in VS might suggest you add declaration automatically