How can i stop my shooting animation after playing?
I began learning unity basics only a few days ago, so i don't know if my question is stupid, and i followed Brackeys 2d tutorials and used the scripts form there. The thing is i got stuck after i made my character shoot. I added to the character an animation made from only one image because i only want to change him from a normal state to a state where his gun is in his hands, but i don't know how to get out of the animation. After i shoot one time, he remains in the shooting position. Here is my weapon script where i added the animation command: using System.Collections; using System.Collections.Generic; using UnityEngine;
public class Weapon : MonoBehaviour { public Transform firePoint; public GameObject bulletPrefab; public Animator animator;
// Update is called once per frame
void Update()
{
if (Input.GetButtonDown("Fire1"))
{
Shoot();
animator.SetBool("IsShooting", true);
}
}
void Shoot()
{
//shooting logic
Instantiate(bulletPrefab, firePoint.position, firePoint.rotation);
}
}
I am interested in any solution possible, and maybe some advices for begginers (what tutorials to follow, script tutorials, etc.) Thanks in advance!