Question by
viniciuslucas06 · Dec 03, 2016 at 02:35 PM ·
c#animationanimationstate
Animation play not working C#
Hello everyone, I'm new to Unity and my animation does not run even though it returns "true", I have a looping animation "idle" it works however the 'shoot' animation does not work.
void Update ()
{
if (Input.GetButtonDown("Fire1"))
{
Rigidbody bullet = Instantiate(myBulletPrefab, transform.position, transform.rotation) as Rigidbody;
bullet.velocity = transform.TransformDirection(new Vector3 (0,0,shootForce));
Animation anim = gun.GetComponent<Animation>();
// AnimationClip clipshoot = anim.GetClip("shoot");
anim.Play("shoot");
}
}
unityquestion.png
(40.2 kB)
Comment
Your answer
Follow this Question
Related Questions
Trying to animate using Breadcrumb(Asset) 0 Answers
Animations get screwed up when I add OnAnimatorMove function 0 Answers
Falling blocks skip animation while upside down 1 Answer
How too climb a ladder with the FPS Controller correctly 0 Answers
What type of variable would I declare an animatable object as? (C#) 2 Answers