make a 3D component as a button

hi,
my game is composed of a cube and a 3D character .
my problem consist in merging the cube how animate my character in order to make it like a button which start the character animation how can I join them and make this script work
i have named the 3D character: femme
And the cube : button —> which is linked to my script
thanks in advance
Sorry for my bad language

add a collider to make the function work
Using OnMouseDown() ?

Yeah. Like what wx91 mention above. If you have a collider, just use the function OnMouseDown.

hello,

it’s about a 3d character whom when i touch it heart dies, falls down when i touch its head. since i’m working on a computer i resorted to cubes to put the animations on. i’ve used animeeple to import a character with a FBX animation. then i’ve created a cube to which i’ve linked the following script:

var femme:GameObject;// femme is the 3d character
femme=GameObject.Find(“mort”);

var etat:int=1;

function Start()
{

var peur=femme.animation[“peur”];
peur.wrapMode=WrapMode.Loop;

Debug.Log(“script started”);
}

function test()
{
yield WaitForSeconds(3);
if(etat==0){
etat=1;
femme.animation.Play();
Start();

Debug.Log(“test”);
}

}

function OnMouseDown(){
if(etat==1){
Debug.Log(“clique me”);
etat=0;
femme.animation.Play(“mort”);
test();
}
}

when i click on the cube an animation goes on. the problem is that the cube doesn’t really follow the character,they are not that synchronized and i want that they look unified. actually i’m trying the cubes and if it works 'ill carry on with them

thank you