Hello,
I am a complete and total newbie to scripting and Unity in general. I am trying to create a simple attack button by pressing the right ctrl button. I finally managed to learn how after a week of research, but the animation will only activate if I continue to press the button rapidly, and it plays rather slow.
How can I get my animation to play on its own when I simply tap the button once? and more quickly? And on a side question whats a basic script for sound effects when attacking?
This is the script I am using:
public class PlayerAttack : MonoBehaviour {
public GameObject target;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(Input.GetKeyUp(KeyCode.RightControl))
animation.Play("Gun Attack 2");
}
}