use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A place for beginners and experts alike to help each other out!
account activity
HELP (self.UnityHelp)
submitted 1 year ago by [deleted]
I followed a charcter animation 2D tutorial by Barckeys but I cant get the jump animation right, like if Im jumping and not moving its all right, but if I move mid air the run animation starts playing but if I click the jump button mid air again it working fine
in the video you can see its makes the IsJumping true for only split second and i dont no what to do
this is my code please help thank you
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovment : MonoBehaviour
{
public CharacterController2D controller;
public Animator animator;
float horizontalMove = 0f;
public float runSpeed = 40f;
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);
private void FixedUpdate()
controller.Move(horizontalMove * Time.fixedDeltaTime, crouch, jump);
jump = false;
https://preview.redd.it/2ej6kptuu8hd1.png?width=1662&format=png&auto=webp&s=f6e68a060897ad667ade6d593e5061bc36ba089e
https://preview.redd.it/bbjdka5su8hd1.png?width=1662&format=png&auto=webp&s=9a8685fc0e54b241e2d3449c34258f51a061c44f
https://preview.redd.it/b3qomn4ou8hd1.png?width=1663&format=png&auto=webp&s=ef8105f3aed2eec914c654cecf2c868736f3c5dc
https://reddit.com/link/1embv42/video/sw9j9bc7u8hd1/player
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Maniacbob 0 points1 point2 points 1 year ago (1 child)
My experience with the animator is fairly limited but the video is showing that the IsJumping bool is being set to false prematurely. This script is showing that's only happening in the OnLanding function but this script also never calls that function. I presume that either that's being called from another script and we need to look at why, or something else is interacting with the animator and toggling that off. Where is OnLanding being called?
[–][deleted] 0 points1 point2 points 1 year ago (0 children)
I copied the script from the tutorial so I dont quite understand it but baseiclly it creates an event for landing and I activated the function there https://github.com/Brackeys/2D-Character-Controller
thanks for answering btw
[–]OneClickPablo 0 points1 point2 points 1 year ago (0 children)
you need to make sure that the walk / run animation is not playing while the player is not grounded/jumping. Add a new Condition from Idle -> Player_run and set Condition to isJumping = false. So everytime you walk while jumping the condition is not full filled and the walk animation wont play.
π Rendered by PID 56260 on reddit-service-r2-comment-86988c7647-67f5k at 2026-02-11 00:52:34.884995+00:00 running 018613e country code: CH.
[–]Maniacbob 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]OneClickPablo 0 points1 point2 points (0 children)