hi,
i want to do a script, to animate a military man, I have all the actions, but on diferents men,
i want that when i push a key, do one action.
how can i do that, because i have seen others scripts of tutorials, and there dont do a reference to any key, for do the action.
i do this first
i put on one man, all the actions, but i cant do that , this man do it.
i am not sure if i understand you correct, maybe that is what you want:
drag the following script onto your character and change the ANIMNAME to whatever you have named it
function Update() {
if (Input.GetKeyDown(KeyCode.UpArrow)) {
animation.Play("ANIMNAME");
}
if (Input.GetKeyDown(KeyCode.DownArrow)) {
animation.Play("someotheranim");
}
}
complete list of keycodes is available here:
[url]http://unity3d.com/support/documentation/ScriptReference/KeyCode.html[/url]