Have compiler warnings more closely match those from Unity
This suggestion is migrated to Developer Community. Please use below link to view the current status.
I'd really like to get rid of all warnings in our project both when compiling in Unity, and when compiling in Visual Studio.
I get that because Unity compiles with Mono, and VS compiles with the .Net compiler so the warnings generated will always be a little bit different. However Unity also suppresses certain warnings because they would otherwise fire on false positives in typical Unity scripts.
I'm thinking particularly of CS0649 which fires on private serialized fields that C# thinks are never assigned a value even though Unity will assign a value when de-serializing the class.
I can get rid of a particular instance of this warning by explicitly assigning a value, but because Unity doesn't enforce this warning 3rd party libraries are rife with it and fixing all of them is impractical.
I can globally disable this specific warning in the project settings. But it seems to get lost as soon as I re-generate the project.
Thanks for your suggestion!
You’re right that because both Unity and VS compile the code with a different compiler you’ll get potentially different messages, but you’re also right that we should let you set the nowarn option from our configuration.
You can easily workaround it by using #pragma warning disable, but having a configuration option is much better.
Jb Evain, Dev Lead, Tools for Unity
Yea I would really like this as an option, at a bare minimum suppressing the unassigned variable warning when using the [SerializeField] attribute would make my life a lot better and make me like using VisualStudio even more