Disable warning messages

Greetings,

Is it possible to disable the yellow exclamation point warnings in the editor console? Many of my variables are not recognized as being used, they are used btw, and my Console is filling up with a ton of these warnings. I would prefer only the serious warnings appeared.

Thanks

In C# you can disable them via a pragma at the top of your script file (I don't think Javascript has anything but #pragma strict). Some common ones being:

#pragma warning disable 0168 // variable declared but not used.
#pragma warning disable 0219 // variable assigned but not used.
#pragma warning disable 0414 // private field assigned but not used.

As other warnings come up you just keep adding them - I strongly suggest you take them out for the final build. :) This is just for development.

To ignore warnings in all files create two text files called gmcs.rsp (for editor scripts) and smcs.rsp (for game scripts) into your YOUR_PROJECT_NAME/Assets directory with contents (for example):

-nowarn:0414

0414 is warning number

Since I found this but isn’t not up to date with later Unity versions, due to different compilers

what @Cardinalby said is correct, but you might need to use the files called csc.rsp and or mcs.rsp Instead. Found that info from here https://forum.unity.com/threads/help-using-obsolete-custom-response-file-mcs-rsp-please-use-csc-rsp-instead.1072442/ in the bottom of the 2nd post.

Edit you can do it in unity player settings now, in additional compiler arguements.

In version 5.9.6 of MonoDevelop, you can just go to View > Message Bubbles.

There you have 3 options:

Console > Find little yellow triangle > click.

Right-click your project → Options → Compiler and either adjust the warning level or list the warnings you don’t want to be told about in the “Ignore warnings” text box.