Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
22
Question by kilgore · Jul 08, 2010 at 02:08 PM · editorconsolewarnings

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

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image yoyo · Nov 15, 2014 at 01:15 AM 2
Share

Be careful when you disable warnings, they are there for a reason -- better to fix the issue (even if it's $$anonymous$$or) than ignore it.

avatar image cregox · Nov 15, 2014 at 02:39 PM 0
Share

Actually, warnings are not errors for a reason too. Sometimes there's no issue to be fixed, and if you know what you're doing, it is very okay to disable the warning. I'd even argue there should be a nicer way to do it so.

5 Replies

· Add your reply
  • Sort: 
avatar image
55
Best Answer

Answer by Cyclops · Jul 08, 2010 at 02:16 PM

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.

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image kilgore · Jul 08, 2010 at 02:21 PM 0
Share

awesome, thanks cyclops. Just to clarify, you suggest deleting all of the pragmas before final build? Is this to make sure you really do not have unused variables and what not? Thanks.

avatar image Cyclops · Jul 08, 2010 at 02:25 PM 0
Share

@Andrew - correct. In fact, any time I am about to make a major check-in to Subversion (version control), I comment the lines out just to check for any problems.

avatar image sdgd · Mar 31, 2013 at 08:02 AM 0
Share

thank you soooo much it got pretty annoying now when I'm rewriting my code

avatar image cregox · Nov 26, 2013 at 03:59 PM 3
Share

you can obviously find the code on the warning message itself. Here are a couple for obsolete code: 0618 and 0612

avatar image Huminaboz · May 11, 2016 at 07:19 PM 5
Share

One thing to add - if you just want to stop the warning on one variable, you can use:

 #pragma warning disable 0219
 int variable = 2;
 #pragma warning restore 0219
avatar image
30

Answer by Cardinalby · Dec 03, 2015 at 08:29 AM

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

Comment
Add comment · Show 7 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ThinhHB · May 23, 2016 at 01:36 PM 0
Share

It work for me !!! Thanks so much

avatar image 578516121 · Oct 13, 2016 at 07:16 PM 1
Share

This is the real & professional solution for Unity Engine. Thanks a lot!

avatar image Jodwig · Oct 13, 2017 at 06:04 PM 0
Share

Just for your information, if you want to reduce compile times by disabling warnings, it won't work. You have to fix the warnings, because they will still be generated, but just not shown in the log.

avatar image Rollie42 · Oct 02, 2018 at 01:32 PM 3
Share

FYI, these files are deprecated - now you just create one file named "mcs.rsp" (see docs: https://docs.unity3d.com/$$anonymous$$anual/PlatformDependentCompilation.html)

avatar image Akrone Rollie42 · Aug 21, 2019 at 08:24 PM 2
Share

This file is now deprecated (if targeting .NET Framework 4.x), use "csc.rsp" x)

avatar image Hemaolle · Dec 18, 2018 at 06:42 AM 0
Share

Note that this will indeed only disable the warnings in Unity console. It's not going to do anything towards adding a element to the .csproj file generated by Unity. This means that if you build in an external editor (Visual Studio, Rider etc.) the warnings will still be there.

To add the disable to the .csproj file, you would have to postprocess the .csproj file after Unity generates it. The answer here can guide you in the correct direction if you want to do that: https://answers.unity.com/questions/54177/change-visual-studio-solution-generated-by-unity.html

Show more comments
avatar image
1

Answer by callme · Nov 25, 2016 at 04:40 PM

Console > Find little yellow triangle > click.

alt text


25-11-2016-19-40-14.jpg (49.6 kB)
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
-2

Answer by Max_power1965 · Jul 10, 2016 at 05:56 PM

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.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image TharosTheDragon · Nov 09, 2017 at 02:15 AM 0
Share

Right-click "your project" where?

avatar image
0

Answer by t36k · Aug 26, 2017 at 12:21 AM

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

There you have 3 options:

  • Hide Message Bubbles

  • Errors & Warnings

  • Errors Onlyalt text


mono-message-bubbles.jpg (104.0 kB)
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

20 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to re-trigger all compiler warnings in the Editor?? 1 Answer

Unity editor stuck/halted on Console (Error) on Windows 7 2 Answers

How to view old console warning messages? 0 Answers

How to clear a specific error/warning in the console output window? 0 Answers

Get rid of certain warnings on the console. 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges