I’m trying to play an animation when the user clicks with their left mouse button.
var glockshoot : AnimationClip;
if (Input.GetMouseButton(0)) {
gameObject.GetComponent.<Animation>("glockshoot").Play ();
}
However, when I use this, the console tells me the following:
The best overload for the method 'UnityEngine.GameObject.GetComponent.<UnityEngine.Animation>()' is not compatible with the argument list '(String)'.
Does anyone know what I’m doing wrong?