- Home /
Question by
RuiFerreira · Jan 25, 2014 at 01:39 AM ·
animationbuttonnoobon
JavaScript: Animation on button Help.
I'm trying to get aiming in my game (By holding down Right Mouse to aim). But I'm a noob at scripting and trying to learn. Can anyone tell me what I did wrong? Please and thanks!
var aim : AnimationClip;
function Update () {
if(Input.GetMouseButtonDown(1));
AnimationPlayMode.aim;
}
Comment
Best Answer
Answer by getyour411 · Jan 25, 2014 at 02:24 AM
This would only return true in the frame the right mouse button was pressed down; you want GetMouseButton (true the whole time it's being held down)
http://docs.unity3d.com/Documentation/ScriptReference/Input.GetMouseButton.html
Check your animation call too
http://docs.unity3d.com/Documentation/ScriptReference/Animation.Play.html