Issue with Input System Package

In this part of the course, I am not able to get Visual Studio to recognize the Input System namespace. I’ve followed along with Rick’s video, but when he starts the code for the player movement, I am unable to continue.

I’ve looked online and have tried everything from restarting Unity and VS, uninstalling and reinstalling the package, regenerating packages, and deleting my .csproj file and regenerating it, but I can’t get anything to work.

Hi,

Do you use Visual Studio or Visual Studio Code? They are two different pieces of software.

I’ve been using Visual Studio throughout the course. Does this one require Visual Studio Code?

No, it does not require VS Code. If you already use VS and like it, feel free to use it for this course too. As for me, I prefer to use VS but that’s a matter of personal preference.

Is Visual Studio selected as your External Script Editor in Unity (Edit > Preferences > External Tools)?

In Window > Package Manager in Unity, make sure the “Visual Studio Editor” package is installed.

Yes, Visual Studio is set as my External Script Editor, and I do have the package installed.

Is there a “Regenerate project files” button or something like that in the External Tools? If so, click on it.

If that did not work, close Unity and VS again and delete the *.sln and *.csproj files in your project folder again. Then launch Unity and double click on your script in Unity.

And which version of Unity do you use? In Edit > Project Settings > Player, make sure the new input system is enabled.

This game is built in Unity 2021.1.26f1.

I’ve tried the “Regenerate project files,” deleting the files, and restarting several times. And I’ve had the input system set as the new one only and as both the new and old. I still keep getting the error in Visual Studio saying “The type or namespace name ‘InputSystem’ does not exist in the namespace ‘UnityEngine’ (are you missing an assembly reference?)” and it shows the files “Assembly-CSharp, Assembly-CSharp.Player” next to it.

Which input system is selected in Edit > Project Settings > Player? Do other Unity namespaces such as UnityEngine.UI work in your code?

Also open the console in VS. Maybe there is a helpful message referring to the problem.

The new input system is currently selected under the Player settings. And UnityEngine.UI was no longer working, it autocompletes as UnityEngine.UIElements.

And can you explain how the console in VS works and what I should be looking for?

Just an update:

I tried rebuilding the game in 2021.1.26f1 with VS Code, and in 2021.1.5f1 with VS Code and I couldn’t get it to recognize UnityEngine.InputSystem.

However I tried again in Unity 2020.3.12f1 with Visual Studio, and the namespace is recognized there (as well as UnityEngine.UI which was not working in the others). Still not sure what was causing the problem though.

In that case, I would suggest to simply use VS instead of VS Code.

I had the same issue. Installing Visual Studio Package solved the problem for me. Thank you!

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

Privacy & Terms