Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
2
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
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 sims11tz · Sep 28, 2012 at 07:38 PM 0
Share

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

BU$$anonymous$$P BU$$anonymous$$P BU$$anonymous$$P

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

· Add your reply
  • Sort: 
avatar image
5
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
Add comment · 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 ins$$anonymous$$d of fixing the issue.

Show more comments
avatar image
1

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
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

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

Can I get a warning if I (involuntarily) declare a new js variable in an assignment? 2 Answers

Script attached to 'Main Camera' in scene '' is missing or no valid script is attached. 0 Answers

Facebook Plugin Warnings 1 Answer

ios cant access variables in array 1 Answer

New Monobehaviour warning - instantiating unattached functions 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