Animation time offset. 'Must be marked as Legacy'

I’m trying to offset sprite’s animation clip time offset. This is what I did:

void Awake() {

	scores = GameObject.FindGameObjectWithTag("GS").GetComponent<GUI_Scores>();
	GetComponent<Animation>().animation["obj_coin"].time = Random.Range(0f, animation["obj_coin"].length);

}

This is the error I’m getting when trying to play the game:

Does anybody know a good way to offset a non-legacy animation’s timing?

+1 I can’t find a solution for this.

If it’s “non-legacy” (i.e. it’s Mechanim) you should be using your Animator, not Animation. See Animator.Play; you’d use the normalizedTime parameter to set your offset.