Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Game Development

All compiler errors have to be fixed before I enter playmode??

I'm trying to enter playmode with my frog but this message just keeps popping up. First, I don't know what compiler errors are and second, I don't know how to fix them. Help???

1 Answer

Seth Kroger
Seth Kroger
56,413 Points

Compilers are what turn human-readable code/script into code that is more machine-readable. It translates the programming language you're using, like C#, into machine code that can be understood by the CPU or a Virtual Machine. A compiler error is basically the compiler saying, "I don't understand you. Can you try that again." There are different types of compiler errors:

  1. Syntax Errors: Programming languages are very picky about grammar. This error means there's a mistake in the rules.
  2. Symbol Not Found: There's a typo in naming a variable, or trying to use a variable/method that doesn't exist.
  3. TypeError: The compiler was expecting a variable to be something but you gave it something else. For instance, it's expecting an Animator but you give it a LightSource.
  4. And others...

The error message itself should tell you what the error is and where the compiler encountered it. It will tell you the name of the script it occurs in followed by two numbers. The first is the line number in the script where it happened (though sometimes the error is in the line above it; it doesn't register as wrong until the next line starts.). When you fix the errors and re-save the script you can try it again.

Feel free to ask more questions if you're still having difficulty.