GUI button-play a 3d model animation

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

The new GUI system works a bit differently.
What you need to do is something like:

public void LogTest()
{
   Debug.Log("FUNCIONA_1");
}

and in your button component, chose the object that contains the script and chose the function.

Check this UI BUTTON (about 8 minutes in).