Please, help :(. So, friends, i don’t know what can i do anymore, i’ve tried everything. I have a running animation, and a bool condition if i press “D” or “A” key down. When i press keys slowly, all seems run ok, but when i press quickly, the animation transition freezes. As i said, i’ve tried everything i could: mark and unmark exit time, configure exit time, manually tried configure animations transitions, put trigger instead bool, but nothing has fixed that problem.
The code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class movimento : MonoBehaviour
{
public Rigidbody2D rig;
public Animator animator;
void Start()
{
rig = GetComponent();
}
// Update is called once per frame
void Update()
{
//Movement axis
Vector3 movement = new Vector3(Input.GetAxisRaw(“Horizontal”), 0.0f, 0.0f);
transform.position = transform.position + movement * Time.deltaTime * 4;
if (Input.GetKeyDown(KeyCode.D))
{
transform.localScale = new Vector2(6.808257f, 6.808257f);
animator.SetBool(“run”, true);
}
else if (Input.GetKeyUp(KeyCode.D))
{
animator.SetBool(“run”, false);
}
if (Input.GetKeyDown(KeyCode.A))
{
transform.localScale = new Vector2(-6.808257f, 6.808257f);
animator.SetBool(“run”, true);
}
else if (Input.GetKeyUp(KeyCode.A))
{
animator.SetBool(“run”, false);
}
}
}