Error building Player because scripts have compile errors in the editor

I am getting this error:

Error building Player because scripts have compile errors in the editor

But there are NO OTHER errors…

If i try to play… i get…

Kinda hard to fix a compile error when there is none…

Probably wont help, but try closing Unity, delete the Temp and Library folders, open Unity let it reimport assets/scripts and try again.

looks like a bug in 5.6.1f1

I’ve gotten this exception before. Turned out to be from using named arguments in my case. I just tried to reproduce it, but I have a much newer version of Unity now, and cannot.

In the older versions, if I did:

public static void SomeMethod() {
SomeOtherMethod(SecondVariable: 2);
}

public static void SomeOhterMethod(int FirstVariable = 0; int SecondVariable = 0) {
///Etc.
}

This would cause the error you are seeing for me.