merrylimpingilsamochadegu
So I have posted this in the Animation tab before, I am having a bug with my jumping animation, it works in the first level but after that the animation is having the bug… I have checked the script and there is no Animation.play() Involved…
The Code for the movement and animation is:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour {
public CharacterController2D controller;
public Animator animator;
public float runSpeed = 40f;
float horizontalMove = 0f;
bool jump = false;
bool crouch = 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);
}
if (Input.GetButtonDown("Crouch"))
{
crouch = true;
} else if (Input.GetButtonUp("Crouch"))
{
crouch = false;
}
}
public void OnLanding ()
{
animator.SetBool("IsJumping", false);
}
public void OnCrouching (bool IsCrouching)
{
animator.SetBool("IsCrouching", IsCrouching);
}
void FixedUpdate ()
{
// Move our character
controller.Move(horizontalMove * Time.fixedDeltaTime, crouch, jump);
jump = false;
}
}
I also checked the other script that handles movement speed but there is no reference to animator or animation in it.
(To describe it more in detail, after the first level [Scene 1] The animation is having trouble detecting the IsJumping Bool that I have set up.)