Most of times I get "Internal compiler error", I just edit anything in any file so it will recompile and then it goes away. Restarting Unity is another way of doing that same thing: triggering the compiler.
This time nothing of that worked.
What could have happened?
Answer by Cawas
Jul 04, 2013 at 08:03 PM
SisterKy have already compiled a fine list for the "what could have happened" part.
The warning, at other hand, gives a very specific information about what did happen: "Unreachable code". I think it is still a compiler bug because of this simple test which does reproduce the same error (which was coincidentally already mentioned by cowlinator elsewhere). Just create an empty project and add this file:
public class test : MonoBehaviour
const // simply remove this line, and error will disappear
bool foo = false;
void Start ()
StartCoroutine( bar() );
IEnumerator bar ()
yield return 0;
yield return 0;
Once you know where this little bug is located it becomes pretty simple to find many ways to go around it. One way is using static readonly instead of const.
Answer by elenzil
5 days ago
changing something from const to static will certainly get rid of this warning, but it also changes the semantics of your code.
imo a better way to do this is to bracket the offending code between
#pragma warning disable 0429 and #pragma warning restore 0429.
#pragma warning disable 0429
#pragma warning restore 0429
(0429 is what worked for me, but you might need to use 0162).
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
17 People are following this question.
Please, Where´s the error? c#
Mono.exe not existing is causing a compiler error
what is a compiler error?
All compiler errors have to be fixed before you can enter playmode!