- Home /
How to make player attack animation play through without holding down a key.
Here's what I'm working with:
#pragma strict
function Start () {
}
function Update()
{
if(Input.GetButton("Fire12"))
{
animation["Morde_MetalAttack1"].weight = 5;
}
{
animation["Morde_MetalAttack1"].weight = 5;
animation.Play("Morde_MetalAttack1");
}
}
I added in animation["Morde_MetalAttack1"].weight = 5;
to try and make it so my animation would play all the way through without holding down the key. This worked but it made the animation loop continuously and no effect from the key at all.
I am also using the Third Person Controller script that comes with unity, I noticed if I disable this I can press the key without holding it, without the added animation["Morde_MetalAttack1"].weight = 5;
and my animation plays through on a single key press.
This has lead me to the conclusion that it's some kind of priority problem with my animations but I'm really not sure how to fix this.. Is there anyway I can just make my attack animation override the idle / running animations I have going on via the Third Person Controller script?
Your answer
Follow this Question
Related Questions
Playing Animation When Two Keys Are Held Down To Play Run Animations 0 Answers
How to play animation on keypress 2 Answers
GUITexture touch play animation 0 Answers
Proper way to play non looping animations 2 Answers
can't get fbx animation to play 3 Answers