• 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
Question by ronronmx · Feb 26, 2011 at 07:30 AM · warningspragma

#pragma warning disable on a global scale from within 1 script only?

I was wondering if there's a way to globally disable warning messages on all scripts, from 1 main script containing all #pragma warning disable error numbers?

Comment
xortrox
v01pe_

People who like this

2 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 sims11tz · Sep 28, 2012 at 07:38 PM 0
Share

I want to know this as well!!!!!!

BUMP BUMP BUMP

avatar image Loius · Apr 11, 2013 at 09:33 PM 1
Share

There are no warnings that can never point to a possible problem, so I'd imagine that no one would bother to implement a way to hide a warning disabler where it will never be found.

2 Replies

  • Sort: 
avatar image
Best Answer

Answer by Aaal · Apr 12, 2013 at 01:20 AM

Sorry, I deleted away my earlier comment. Should have commented instead of answered. But now I have found out the answer to my needs.

Ok for JS n boo users, please refer to unity manual. For c# users, create a file n name it smcs.rcp. Save this file under your assets/ folder. As for what to key in, you can either do a 'smcs -help' n find out all the options or key 'man smcs help' or something similar on the Internet. It will retrieve manual pages of smcs options. These are served as arguments to the compiler when it begins its compilation. You will ONLY notice the difference ONCE you update your scripts.

Ok, for a simple example, I need to disable warnings that imported packages always prompt. I have decided not to change their scripts as the updates will overwrite mine. Hence, create the file as I mentioned above and to disable the warnings, just key -nowarn:XXXX, where the XXXX is the number code of your warning. Voila! It works like charm.

As for c# editor's warnings or other global settings for it, create gmcs.rcp file instead.

Comment
ronronmx
Loius
clunk47
vsugrob
yusufdemir2012

People who like this

5 Show 9 · 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 ronronmx · Apr 12, 2013 at 06:38 AM 0
Share

You just made my day :)

avatar image whydoidoit · Apr 12, 2013 at 06:42 AM 1
Share

Per @Louis's point though - you will never see those warning for your own code either right? Since 4.1 and the new ability to hide warnings in the console it would feel dangerous to me to suppress them. I guess it does make my build logs pretty large.

avatar image ronronmx · Apr 12, 2013 at 06:56 AM 0
Share

There are a few warnings that I disable in most of my scripts, but I still want to re-enable them when I do some debugging, and going through each script is a pain. Having a central location to enable/disable such things is definitively a plus!

avatar image Loius · Apr 12, 2013 at 07:08 AM 0
Share

Super thumbs-up for finding that. Hopefully only responsible users will take advantage of it. :D

avatar image Bunny83 · Apr 12, 2013 at 07:28 AM 1
Share

@ronronmx: I'm just wondering what are those warnings you want to hide. Any examples? I can't think of any warning i just want to hide instead of fixing the issue.

Show more comments
avatar image

Answer by sewy · Feb 07, 2020 at 02:35 PM

For .NET 4.x the file is csc.rsp and the text insede looks like -nowarn:CS0414,CS0649

https://docs.unity3d.com/Manual/PlatformDependentCompilation.html https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/nowarn-compiler-option

Comment
Raikish

People who like this

1 Show 0 · 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

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta by June 9. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

9 People are following this question.

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

Related Questions

Several shader warnings with Unity's SSAO image effect 1 Answer

Warning: Ignoring asset refresh (2017.1.0f3) 1 Answer

Custom Sort class array error if i use #pragma 2 Answers

Javascript - How to get an error if typing int instead of float? 0 Answers

Why so many warnings in xcode? 0 Answers


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