- Home /
Question by
HELL Hamster · Nov 20, 2012 at 05:18 PM ·
animationloopjavastop
how to stop animation loop?
i have this java script that does what i need however i cant figure out how to stop the animation looping after it has played once. var animation_bool : boolean ;
function Update()
{
if(animation_bool == true)
{
animation.Play("Sword_Swing1");
}
if(Input.GetButtonDown("mouse0"))
{
animation_bool = true;
}
}
Comment
Answer by Olgo · Nov 20, 2012 at 05:42 PM
Hi, for something like a sword swing you wouldn't want to use a loop. You need to set the wrap mode of each animation you use.
Check these references out:
http://docs.unity3d.com/Documentation/ScriptReference/AnimationState-wrapMode.html
and
http://docs.unity3d.com/Documentation/ScriptReference/WrapMode.html
Your answer
Follow this Question
Related Questions
Select frame for Animation 1 Answer
Won't loop animation (solved!) 2 Answers
How to stop animation on trigger? 1 Answer
Stopping an animation from looping at the end? 3 Answers
random animations? 1 Answer