Hide Warn Global In Unity

Sometime, The warn info are turn into error msg in unity's console, Although we can find the error msg in the end of msg's detail,But when we have a lot of warn, It can't be showed until you fixed most of the warn.So we need to hide the warn infos simplely.

There are some way to do that,

1、you can disable them via a pragma at the top of your script file  

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

(when you need to restore,you can do it like this: #pragma warning restore 0168 )

2、Global Hide

create a file n name it smcs.rsp(gmcs.rsp ,us.rsp). Save this file under your "assets/" folder,just type "-nowarn:168" 


mark:

1.The problem is often caused by some code trigged InternalErrorException.

2.168 is the numeric part of the warning identifier(CS0168).


Reference Url

https://msdn.microsoft.com/zh-cn/library/7f28x9z3.aspx

http://docs.unity3d.com/Manual/PlatformDependentCompilation.html

http://manpages.ubuntu.com/manpages/jaunty/man1/gmcs.1.html

http://answers.unity3d.com/questions/49540/pragma-warning-disable-on-a-global-scale-from-with.html

http://answers.unity3d.com/questions/21796/disable-warning-messages.html

http://answers.unity3d.com/questions/428915/many-warning-as-internal-error.html

發佈了228 篇原創文章 · 獲贊 49 · 訪問量 48萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章