Hello,
i just need to say, before i start, that i am a bit of a noobie to unity scripting.
basically i would like to know how (if it’s possible) to put 2 animations on to 1 object. i am making a gun and i have the left mouse click assigned to fire, so thats good. this is the code i used for that;
function Update () {
if ( Input.GetButtonDown(“Fire1”) ) {
transform.animation.Play("Default Take 1");
}
}
so now i have made a new animation on the same gun, to reload. but i cant get it to work. i want to be able to push the ‘R’ key for the reload animation to play.
this is the code for that;
function Update () {
if ( Input.GetKeyDown(KeyCode.R) ) {
transform.animation.Play(“Reload”); }
}
when i play the game and click with the left mouse key, it fires the gun like it should, but when i press the ‘R’ button it come up with an error saying:
The animation state Reload could not be played because it couldn’t be found!
Does anyone have an idea of how to get both the inputs to start the animations which i have set them to?