Hey, Im animating a character and id like to know if it is possible to have if(Input.GetButtonDown(none)) { //play standing animation } if it is possible or something along those lines that would be very helpful. thank you.
preferably JAVA
Hey, Im animating a character and id like to know if it is possible to have if(Input.GetButtonDown(none)) { //play standing animation } if it is possible or something along those lines that would be very helpful. thank you.
preferably JAVA
Actually there is a function called "else" that will do something at all other times when it is not pressed.
Ex. (Fill in):
` function Update () { if (Input.GetButtonDown("(BUTTON NAME HERE)")) { //Do Something (Ex. animation.Play();) } else { //Play another animation for idle position } }`
Ex. (All parts):
` var jumpAnimation : AnimationClip; var idleAnimation : AnimationClip;`function Update () { if (Input.GetButtonDown("Jump")) { animation.Play("jumpAnimation"); } else { animation.Play("idleAnimation"); } }
The object that you attach this script to needs to have an animation component and have the two variables have to have the animation you want to play. You should not encounter any errors from the script. If you need to, you could change the input for a different purpose.
There is also Input.anyKeyDown, which will tell you if any key is pressed on the keyboard, so if(!Input.anyKeyDown) would tell you nothing is pressed.
I probably wouldn't use it for this though, the other solutions seem like what you need
Yes, you would use the "else" keyword. It will be called when the "if" condition is false.
if (condition) {
}
else {
}