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 How to Make a Video Game Player Input and Cameras Move the Player with Animation

My play button isn't working. My script for mono script said it had a bunch of errors, and my Unity is also error filled

Here is my mono script page: using UnityEngine; using System.Collections; using System.Collections.Generic; public class PlayerMovement : MonoBehaviour { private Animator player Animato(r; private float moveHorizontal private float moveVertical private Vector3 movement // Use this for initialization void Start () {

}

// Update is called once per frame
void Update () {
    moveHorizontal = Input.GetAxisRaw ("Horizontal");
    moveVertical = Input.GetAxisRaw ("Vertical");

    movement = new Vector3 (moveHorizontal, 0.0f, moveVertical); 
}

}

1 Answer

Henrique Vignon
PLUS
Henrique Vignon
Courses Plus Student 6,415 Points

Well, it's really hard to read the code like this, you can paste the code in between 3 back sticks so it retains it's format with indentation and all (check the mark down sheet to see a better explanation on how to do that).

But for what I can see you forgot a bunch of semicolons at the line ends of your variable declarations, plus you wrote

private Animator player Animato(r;

and it should be

private Animator playerAnimator;

When declaring variables you can never use spaces or special characters such as "(", when you put in a space the compiler thinks you're done with that variable and looks for a semicolon to end the instruction or a "=" for assignment.

I suggest you re-watch the video and take close attention when the teacher writes the script, it's a good idea to just wait till he does it, listen to his explanation, then pause the video and write it yourself.