I have a platformer game, and once I reload the scene(if the hit a certain point(using trigger)) The jump animation no longer works.
I am using the player controller form Brackeys 2d movement in Unity video
Here is my script for how I am moving:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMove : MonoBehaviour
{
// Start is called before the first frame update
public float runSpeed = 40f;
float horizontalMove = 0f;
bool jump = false;
public CharacterController2D Controller;
public Animator animator;
// Update is called once per frame
void Update()
{
horizontalMove = Input.GetAxisRaw(“Horizontal”) * runSpeed;
if(Input.GetButtonDown(“Jump”)) {
jump = true;
animator.SetBool(“IsJumping”, true);
}
animator.SetFloat(“Speed”, Mathf.Abs(horizontalMove));
}
public void OnLanding(){
animator.SetBool(“IsJumping”, false);
}
void FixedUpdate(){
Controller.Move(horizontalMove * Time.fixedDeltaTime, false, jump);
jump = false;
}
}
Note: I have linked up the objects where they are needed