I spent hours trying to solve this problem: when I run the game, the character is moving correctly to the right and left, but when pulling the gun happens, the character never moves for some reason.
Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WalkParent : MonoBehaviour
{
private Animator animator = null;
private Rigidbody2D rb;
// Start is called before the first frame update
void Start()
{
animator = GetComponent<Animator>();
rb = GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update()
{
float dirX = Input.GetAxisRaw("Horizontal");
rb.velocity = new Vector2(7f * dirX, rb.velocity.y);
if (Input.GetButtonDown("Jump"))
{
rb.velocity = new Vector2(rb.velocity.x, 7f);
}
if (dirX > 0 || dirX < 0)
{
animator.SetBool("isWalking", true);
}
if (dirX == 0)
{
animator.SetBool("isWalking", false);
}
if (Input.GetButtonDown("Fire1"))
{
animator.SetTrigger("pull");
}
if (Input.GetButtonDown("Fire2"))
{
animator.SetTrigger("nopull");
}
}
}

I trigger the “Gun” animation with animator.SetTrigger("pull"); and it’s just pulling the gun animation.
This is how the problem looks:

I thought it’d be easier to connect “Any State” to “Gun.” But what I had tried for the first time was using “Bool” for all of the animations and then connecting them together without using “Any State,” and the problem still happened. I don’t know if it’s because “Gun” and “Walk” have the same keyframes for bones, so that creates this problem for me.