Question by
martiros24 · Nov 21, 2015 at 10:11 PM ·
animatoranimator controller
how to play clip animation via animator Onclick?
I got the avatar of hand, animator with clip, c# :
public GameObject youranimatableObject;
private Animator yourAnimator;
void Start()
{
yourAnimator = youranimatableObject.GetComponent<Animator>();
}
void Update()
{
if (Input.GetMouseButton(0))
{
yourAnimator.animation.Play("slash"); // here i got errors 'Component.animation' is obsolete: 'Property animation has been deprecated. Use GetComponent<Animation>() instead. //but using it is not a solving)
}
}
screenshot-6.png
(110.9 kB)
Comment