How to fix a compiler error?

Hi! I tried to enter play mode but a error appeared: “all compilar errors have to be fixed before you can enter play mode”.

This error appears since i tried to make a script witch should make an animation play only when i click left.

Screen with the script that cause the error:
Screen with the errors :

Can someone help me? Where is my mistake?

The error is very explicit: you’ve written animation.Play, but not declared anywhere what “animation” is.
If you want to access the animation component attached to the gameobject, you need to use:


I also recommend you read the manual or some beginner’s tutorials.

The reference to animation is missing. In your start function, call

animation = GetComponent<Animation>();