All compiler errors have to be fixed before you can enter playmode

ConsoleEditor message · Editor

All compiler errors have to be fixed before you can enter playmode!

At least one script in the project fails to compile, so Unity cannot run any of them. This message is a symptom; the real errors are the red CS lines in the Console.

Read the Console line first

Turn on only the red error filter in the Console and scroll to the first CS error. Later errors are often caused by the first.

Common causes

  1. An error in one of your scripts

    Double-click the first red CS error to open the file at the right line. CS0246, CS0103 and CS1002 (missing semicolon) are the usual first ones.

  2. An error in a package or imported asset

    Errors in Packages/ or a third-party folder block Play Mode too. Updating the package, or removing the asset, usually clears it.

  3. The Console is showing stale errors

    If you fixed the code but the message stays, the Editor may not have recompiled. Save the file, focus the Unity window, and use Assets > Refresh.

The fix

Fix
C#
// The usual first error: a missing semicolon (CS1002)
float speed = 5f   // add ; here
rb.linearVelocity = direction * speed;

Stop it coming back

Keep the Console's Clear on Recompile option on, and fix errors as they appear rather than in a batch.

Questions

The Console shows no errors. What is blocking Play mode?
Check that the Console's error filter (the red icon) is switched on and that no search text hides the errors. If it is still empty, right-click the Assets folder and choose Reimport, or delete the Library/ScriptAssemblies folder while Unity is closed to force a clean compile.
Unity offered to open in Safe Mode. Should I?
Yes. Safe Mode opens the project without importing assets until scripts compile, so you can fix the errors without errors cascading through imports. Fix the first error in the list, and the rest often disappear with it.
The error is inside a package I did not write. What do I do?
Update the package in the Package Manager, or remove it if you do not need it. Package errors after a Unity upgrade usually mean that version does not support the new editor; the package's changelog lists the supported versions.

Related errors

Got a different error? Paste it into the error lookup.