- Home /
Javascript: Disable warnings
How do I disable warnings in JavaScript ?
I've tried
#pragma warning disable 0015
But I get error message:
BCE0044: unexpected char: 'd'.
I don't think #pragma warning disable xxxx exists in JavaScript.
The unexpected character is probably the 'd' in 'disable'. I'm pretty sure this is not supported in JS/US. It is only supported by the C# compiler.
You should always heed warnings, and be sure to fix them for your final build. Ignoring the problems won't make them go away.
Yeah it's good to correct your errors, but when working in UnityScript you get all kinds of bogus namespace warnings from $$anonymous$$onoBehaviours if you don't use any elements from UnityEngine, UnityEditor, and System.Collections. Also, I'm constantly doing things like creating a debug function, then rem$$anonymous$$g out the caller of it which then gives me an annoying "function is never used" warning. "Fix all your warnings" is not a good answer.
Its yet another of a long, long list of pitfalls with UnityScript that you can't silence the warnings like in C#. I wish they'd just get rid of UScript and force everyone to use C# in the first place ins$$anonymous$$d of luring you in with the "easy of use" argument only to find you're stuck in a corner 2 years down the road when you've built too big a pyramid to start over.
Incidentally, if you're tired of the BCW0016 warnings EVERY SIGNLE script throws, I have an ugly but effective workaround posted at http://answers.unity3d.com/questions/278276/how-can-i-close-the-namespace-never-used-warning.html
Quicker, easier, more seductive. If once you start down the dark path, forever will it do$$anonymous$$ate your destiny, consume you it will, as it did Obi-Wan's apprentice.
I found this thread wanting to suppress a warning about using bitwise logic ins$$anonymous$$d of boolean.
Thing is, I WANT bitwise:
returnVal |= updateObject(objArr[i]); //function returns true if the object changed
Which is inside a loop that should continue to run until no object changes.
Answer by Beyond-Ken · Dec 25, 2012 at 05:15 PM
Try adding this unused class to the bottom of your script:
private class ShushES {var q:Queue; var h:Help; var g:GUI;}
Your answer
![](https://koobas.hobune.stream/wayback/20220613073645im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
UNITY3D: TEXTFILE I/O : Don't write same things 0 Answers
How to make a List Constructor? 1 Answer
Assets/Standard Assets (Mobile)/Example/ExampleScript.js/(13,104): BCE0044: expecting :, found ';'. 0 Answers
Can I convert unityscript to boo? 0 Answers
Can't use script name as variable type? 2 Answers