I'm attempting to learn Unity's new input system, but when I try to add using UnityEngine.InputSystem;
to my code it gets a red squiggly line under it. It doesn't cause any compiler errors, but it's very annoying. How do I get Visual Studio to recognize this so Intellisense will work again?
-
\$\begingroup\$ Did you install the package for the new input system through the unity package manager? Did you restart Unity and Visual Studio afterwards? \$\endgroup\$– PhilippApr 16, 2021 at 7:44
-
\$\begingroup\$ yes I did both of those. \$\endgroup\$– MillardApr 16, 2021 at 10:13
-
\$\begingroup\$ Is the correct Visual Studio version selected in your "External Tools" preferences in Unity? You may also want to try hitting the "Regenerate project files" button in Unity to see if that helps. \$\endgroup\$– DMGregory ♦Apr 16, 2021 at 11:36
-
\$\begingroup\$ Where is the Regenerate project files button located? I can't find it on Google. \$\endgroup\$– MillardApr 16, 2021 at 18:18
1 Answer
I found the answer online! I had to go to the editor preferences (Edit -> Preferences) and under External Tools, there's a section with checkboxes under "Generate .csproj files for:." All I had to do was check "Registry Packages," click Regenerate project files, and it worked! Thanks to everyone who tried to help, and to DMGregory for his comment on generating project files. I hope this question can help someone else.