Visual Studio 2019 insistent on removing Unity methods such as Start, LateUpdate

Yet another issue with transitioning to 2019. :roll_eyes: I’ve searched all over the internet and the only related discussion I can find to this is a Github issue on the Roslyn repo: Allow an analyzer to suppress diagnostics · Issue #20242 · dotnet/roslyn · GitHub. There’s no code style/formatting option to suppress IDE0051, “Remove unused member”, which is especially egregious towards methods invoked by Unity during runtime, without globally supressing this warning through a suppression file, or littering my source files with #pragma pre-processor directives, both of which I consider worst-case scenarios to simply ignoring the IDE “warnings.”

If anyone has a solution other than what I’ve listed, I’m keen to hear it.

4 Likes

I installed the ReSharper Extension ‘Unity Support’ as a workaround.
ReSharper > Extension Manager… > Search for ‘Unity’ > Click ‘Install’ on ‘Unity Support’

found on c# - Resharper warns about unused methods called by Unity3D - Stack Overflow

Has anyone found a proper solution? I don’t have ReSharper.

The fix is simple.

In Unity, go to the Edit=>Preference and then in that window click on the External Tools tab, and click Regenerate Project Files:

This happens when you upgrade Visual Studio.

5 Likes