"Private Member is Unused" and Using directive is unnecessary

Hello,
I completed the Swappable Controls Systems lecture, and everything was and still is working fine.
However, when I opened Unity and VS today to continue with the next lecture, I saw warnings that weren’t there before.

I noticed in all my scripts, Update() and Start() are greyed out. When I hover over, I see this warning:
image
Private member ‘Fighter.Update’ is unused

You don’t normally call Update or Start so, I’m wondering if there is some kind of issue between Unity and VS Code? However, the game does run as expected when I hit play.

I also noticed that System.Collections, and System.Collections.Generic are greyed out with a warning as well:
Screenshot 2023-08-07 174946
Using directive is unnecessary

I’m not really sure what’s changed. I’ve tried closing and re-opening VS Code and Unity, but the warnings persist.

Also, many of my variables now have a blue squiggly line suggesting I make them read-only

For the most part, my code matches the lectures exactly, and the game is working, so I’m not sure how big of an issue this is, but I appreciate any insights you may have.

Thanks!

Within Visual Studio Code or Visual Studio Community, the compilers don’t really have a way to know that methods like Start, Awake, Update, etc will be called by the Unity Callback system (they don’t link in the same way). Not much to do with that particular message but to ignore it.

The using directive is unneccessary message is leting you know that in this script, nothing references System.Collections or System.Collections.Generic. They can be safely removed from the script. It’s generally a good idea to remove any using clauses that are unnecessary because when the project is built, some using clauses, though unused, can cause linking issues.

Privacy & Terms