On Collision Enter Press F

hey guys i have a question how do i do a Function Update(){ OnCollissionEnter(){ if inpud GetKeyDown ("F"); Animation.Play(); {

so when i enter a trigger cub with this script on it the animation will not play until i press F

OnCollisionEnter is only called the frame the collision begins. For the entirety of the collision you'll want OnCollisionStay.

If you're using a trigger, however, you may want to use OnTriggerStay

var canAnimate:boolean = false;

function OnTriggerEnter(coll:Collider){
    canAnimate = true;

function OnTriggerExit(coll:Collider){
    canAnimate = false;

function Update(){
    if(Input.GetKeyDown("f") && canAnimate){