Enabling mesh rendere with animation event

Hi, I’m using an event in animation window to enabling mesh renderer.
this is my simple function that is called with event:

var game : GameObject;

function enable() {
    Debug.Log ("OK");
    renderer.enabled = false;
}

The term “ok” is printed on screen but the gameobject rendering is still enable and nothing occur. How can i disable rendering with an animation event?

Are you sure the animation component and the renderer component are on the same GameObject ? If not, you need to find the renderer in the children.