My jump animation plays the first frame and then instantly goes to idle. I have checked everything I can think of! Code below:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player_Movment : MonoBehaviour{
public CharacterController2D controller;
public Animator animator;
public float runSpeed = 40f;
float horizontalMove = 0f;
bool jump = false;
// Update is called once per frame
void Update()
{
horizontalMove = Input.GetAxisRaw("Horizontal") * runSpeed;
animator.SetFloat("Speed", Mathf.Abs(horizontalMove));
if (Input.GetButtonDown("Jump"))
{
jump = true;
animator.SetBool("IsJumping", true);
}
}
public void OnLanding ()
{
animator.SetBool("IsJumping", false);
jump = false;
}
void FixedUpdate ()
{
//Move our character
controller.Move(horizontalMove * Time.fixedDeltaTime, false, jump);
jump = false;
}
}