- Home /
Hotkey to play animation
Hi,
I am currently working on a project in which all the animation is done within Unity itself. I would like a hotkey that plays the current animation I'm working on (essentially just presses the Play button in the animation window). Does anyone have a script or knows how to make a script for this?
Thanks, Seb
Answer by TotalAnnihilation · May 22, 2015 at 07:13 PM
Hello Inazuma,
I did not quite get what you wanted, but does this help? When pressing space, it will play one animation from the animation component on the game object.
var currentAnim:String;
function Update () {
if (Input.GetKeyDown ("space"))
animation.Play(currentAnim);
}
Your answer
Follow this Question
Related Questions
Hotkey to play animation 1 Answer
Can I force Repaint Animation Window? 1 Answer
How to query the Animation Editor window's scrubber time? 0 Answers
Adding Multiple Keyframes 1 Answer
Adding Multiple Different Keyframes 2 Answers