HI Everyone. I import a FBX 3d model and i Split the animation in 4 parts. I added a gui button (canvas) to the scene and i want play an animation when i clicked it. I test this code :
// Update is called once per frame
void Update ()
{
if(Input.GetKeyDown("w")){
animation.Play("caminar");
}
if(Input.GetKeyDown("a")){
animation.Play("arrodillarse");
}
if(Input.GetButtonDown("Jump")){
animation.Play("brazos");
}
}
and work fine using the keyboard. But i want do the same with the gui button.
I write this code:
using UnityEngine;
using System.Collections;
public class MouseButton : MonoBehaviour {
void OnMouseDown()
{
Debug.Log("FUNCIONA_1");
}
void OnMouseUp()
{
Debug.Log("FUNCIONA_2");
}
}
And i add it to the button but doesnt work!!
Can i someone how i could do that?
Thanks