play an animation after pressing a key

Hello everyone, I need to play an animation after pressing a keyboard key, but when I press the key: the key must be pressed so that the animation continue otherwise it will stop … must must I do so that the animaiton continue after I press without keep pressing on the key … thanks in advance

Added code:

function Update(){
    if(Input.GetKey(KeyCode.Space)){ 
        this.animation.Play("RmasserP");
    } 
}

See these answers here:

Please use the search feature - it works quite well. If you run into specific issues, feel free to ask.

I tried all the solution in there, but it doesn’t work, it doesn’t play the animaiton until the end…

this is the code:

function Update(){

if(Input.GetKey(KeyCode.Space)){
this.animation.Play(“RmasserP”);

}
}