Compiler Errors#

Compiler errors describe issues with code that will stop it from being compiled and used. These errors are accompanied by warning messages, error codes that detail what failed.


When assessing compiler errors, clear the console and work top-down to resolve the first reported error before all others.



Assets/Scripts/Example.cs::(21,40): error CS1001: Identifier expected

The file name, line number, column number, error code, and description are the key pieces of information to look for.

file name, the file containing the code that has the compiler error.
line numbers are found in the gutter of your IDE (the left-hand column beside your code).
column numbers are usually found in the bottom right of the IDE's status bar, in the format line number:column number.
error codes are the shortest description of the issue with a code block. Using a search engine or MSDN with this code will provide information to resolve the issue.
descriptions provide important context to the error code, explaining what specifically may be wrong.


If your error isn't underlined in red in your IDE, configure it correctly. Compiler errors should be underlined, and you should see autocompleted suggestions as you type.


Errors in packages#

If errors are appearing from a package, and not Assets, then either the package isn't valid for your version of Unity, or it is corrupted. Go to the Package Manager (WindowPackage Manager), expand the dropdown for the package having issues, and upgrade or downgrade versions until you no longer have errors in the project.