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.
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.
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.
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.
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?
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.