Mac/Windows game build error

I hope someone can help me. Every time I try to build in Unity, I get an error saying that it could not build because I have compiler errors, but I don’t.

“Error building Player because scripts had compiler errors”

I’m wondering why this is happening, and how it can be fixed. Do I need to get rid of every small error, even tho the game runs fine in the simulator?

I hope this isn’t a redundant question, but have you tried opening the console to check for compiler errors? If so, what errors are being reported? It’ll be very difficult to help you without more information.

Yes you have to fix every little small error. If you really can run it in the editor without any errors, you propably used something from the UnityEditor namespace. Everything from this namespace can’t be used by your game since it’s only available in the editor.

If you used any of these classes in your game scripts you can’t build your game.

Editor scripts need to be placed in a subfolder called “Assets/editor/”. These scripts are not included in your build, they are only extensions for the editor.

I also agree with @rutter, without some information about the errors, we can’t help you. Check the editor log if the build failed (the little button at the top right of the console window)

Could this be? I just clicked clear and tried it again, and for some reason it was working!