Home > Mobile >  Visual Studio will not recognize Unity modules
Visual Studio will not recognize Unity modules

Time:07-01

I am a complete beginner to Unity, as well as Visual Studio 2022.

I was trying to make a 2D game, and have been following along this tutorial, enter image description here

The libraries also do not light up green, but I am not sure if that is just a theme difference between us, but this is a clean install with the default dark mode.

CodePudding user response:

At 22:20 in the video they get the Input System package from the Package Manager.

The documentation for InputValue says it's from the UnityEngine.InputSystem namespace, so when you see the error:

error CS0246: The type or namespace name 'InputValue' could not be found

It's the compiler telling you it can't find the namespace where InputValue is defined.

To solve this problem, you need to add a "using" statement at the top of the file to tell the compiler where to find that function.

using UnityEngine.InputSystem;

Their code won't work without it, either and actually at 31:50 in the same video you see them realize the error and correct it as well.

  • Related