Compiler Warnings Are Now Errors
Hello
All of the sudden my Unity project is confusing compile warnings for compile errors. For example; I am unable to run my game because of the following 'compile error':
Internal compiler error. See the console log for more information. output was:Assets/MainScripts/MenuManager.cs(88,34): warning CS0219: The variable
inputMovement' is assigned but its value is never used Assets/MainScripts/MenuManager.cs(110,26): warning CS0219: The variable
inputMovement' is assigned but its value is never used
This is a simple compile warning that has been there for a while (the class MenuManager is not fleshed out yet). Is there a way to make Unity3d or MonoDevelop not make a warning an error?
I have cleaned my Monodevelop project and rebuilt it. But still no luck. Any ideas whats gone wrong (why warnings are now errors) and how I can fix it?
That does seem disturbing. But, comment out input$$anonymous$$ovement
until you eventually use it?
I mean, many new warnings really do tell about things you should fix, right away, and old warnings just clutter it up.
In my case: catch(Exception e) { //you shoud use e Debug.log(e); } OR catch(Exception) {}
Answer by Archie888 · Aug 30, 2015 at 06:00 PM
I had an issue like this, with threaded stuff, tasks involved etc, using Parse with unity. In my case, I had one error line, in which it seemed that warning messages were written on. If you have a scenario like mine, scroll down the whole message, and you will see that this is not only about warnings turning into errors, but there is an actual error message there in the end, with a long stack trace.
My specific error message was: "Unhandled Exception: System.ArgumentException: Trying to emit a local from a different ILGenerator."
I had a try-catch block in my code. Removing that try-catch block removed my specific issue.
Very weird. I'll repeat this post in all threads on the issue I can find, perhaps it can help someone.
This. Though, removing the whole try-catch block wasn't necessary. What I did was: "catch(Exception e)" to "catch" and it compiled.
After fiddling around a little, I found out that actualling using "e" in the catch block also fixes the issue for me.
I got this error when I changed a method to be run as a coroutine ins$$anonymous$$d of just being run normally off the main thread. The method had a try-catch in it, so I presume Unity coroutines simply don't like try-catch in them. Removing the try-catch or making the method not run inside a coroutine solved the problem.
Excellent tip, thank you! Beneath my sea of warnings was an error about a not being able to compile a specific line of code. I took out the named parameters and it worked.
Thanks, for me the problem was the use of the params
keyword in an attribute constructor. I'm still not sure why it's throwing a $$anonymous$$ono.CSharp.InternalErrorException
though :/
(I love the exception message making no sense: VerifyArgumentsCompat didn't find any problem with rejected candidate ConstructorBuilder ['$$anonymous$$yCustomAttribute'])
Answer by Fornoreason1000 · Jun 03, 2014 at 04:31 AM
Oh oh.. "internal Compiler Error" is bad news, how ever could you post lines 110,88 and 34 of your Menu Manager script? that way i can guide you top a way of hopefully fixing your compiling errors.
Internal Compiler are bad news for one reason: your are likely not at fault and some internal glitch has messed up the compiler... basically unity's compiler is having major issues with MenuManager script for whatever reason and is getting unhanded errors in the compiler itself.
Now to fix it is not easy... try importing MenuManaer.cs to a new project and see if it still does it. then try backing up and removing MenuManager.cs. Sometimes i have notice that projects just go kapoot... other times is when the error is so bad that unity doesn't even know what it is... any rate your warning are "converting themselves into errors" but warning can cause them.
your warning says "variable is assigned but never used" this usually does not cause an error, its more of a performance thing.
Cleaning your MonoDevelop project will do nothing if you haven't cleaned the unity, remember unity is the one with the error not MonoDevelop.
Also i strongly suggest you contact Unity support, they are trained to deal with these cases. you know "internal Compiler Errors"... only they can fix it since the error is in Unity itself.
Answer by Kurius · Nov 30, 2016 at 10:51 PM
I had what seemed to be several warnings appearing as errors! When I scrolled down through the warnings, I noticed there truly was an error listed at the very end.
ERROR... "Unhandled Exception: System.ArgumentException: Trying to emit a local from a different ILGenerator"
CAUSE... The error occurred because I had just put a TRY CATCH statement inside a COROUTINE. Unity doesn't like that!
SOLUTION... I resolved the error be removing all Try Catch statements from all Coroutines.
Answer by alok-kr-029 · Feb 13, 2015 at 04:20 AM
I solved it by removing the warnings one after the other and all of the sudden the compile error disappeared though there was many warning If you have this problem just start solving the warning save the code check it in unity do this till your error disappear
Your answer
![](https://koobas.hobune.stream/wayback/20220613150642im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to enable 'unsafe' code option when debugging using Monodevelop 1 Answer
Problems debugging with Monodevelop 0 Answers
I can't type ANYTHING in monodevelop after upgrade a project from unity 4.6.8f1 to 5.3.1f1 1 Answer
Why does UnityEngine not exist in the current context? 0 Answers
Why does MonoDevelop crash on startup when it's run by a second user on my computer? 0 Answers