Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Game Development How to Make a Video Game Player Input and Cameras Move the Player with Animation

Bjorn Van de Weyngaert
Bjorn Van de Weyngaert
1,297 Points

I have completed the "move the player with animation tutorial". The frog jumps but doesn't move forward. Please help?

This is the code:

using System.Collections; using System.Collections.Generic; using UnityEngine;

public class PlayerMovement : MonoBehaviour {

private float moveHorizontal;
private float moveVertical;
private Vector3 movement;

void Start () {
    playerAnimator = GetComponent<Animator> ();
void Update () {
    moveHorizontal = Input.GetAxisRaw ("Horizontal");
    moveVertical = Input.GetAxisRaw ("Vertical");
    movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);

void FixedUpdate () {
    if (movement != Vector3.zero) {
        playerAnimator.SetFloat ("Speed", 3f); 
    } else {
        playerAnimator.SetFloat("Speed", 0f);


Any ideas why the frog jumps but does not move forward when playing the scene?

Thank you!

2 Answers

First of all: Did you miss to create the playerAnimator variable? (private Animator playerAnimator;)

And check in the inspector if the "Apply Root Motion"-checkbox of the Player's Animator component is checked. :)

This may be a workaround. I just fixed the same problem by clicking Environment asset, then Terrain, and unchecking "Terrain collider". I realized that my frog could barely move against any of the little grass or other terrain details. Strong plants.