I was watching an old brackeys video about how to do 2d animation and I'm confident I've followed everything in the tutorial properly. Everything was going fine until I started the jump animation. The jump animation will not stop during the on landing function. The video is here https://www.youtube.com/watch?v=hkaysu1Z-N8&feature=emb_logo and my code is this:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public CharacterController2D controller;
public float runSpeed = 80f;
float horiztalMove = 0f;
bool jump = false;
public Animator animator;
// Start is called before the first frame update
// Update is called once per frame
void Update()
{
horiztalMove = Input.GetAxisRaw("Horizontal") * runSpeed;
animator.SetFloat("Speed", Mathf.Abs(horiztalMove));
if (Input.GetButtonDown("Jump"))
jump = true;
animator.SetBool("Jumping", true);
}
public void OnLanding ()
{
animator.SetBool("Jumping", false);
}
void FixedUpdate()
{ //move our character
controller.Move(horiztalMove * Time.fixedDeltaTime, false, jump);
jump = false;
}
} If there is any other code or screenshots you would like me to send i will.