How to start animation from special frame

Hi. I’m new to Unity. I use the last version of Unity, 5.1.2f1 Personal.

I want to start an animation from special frame. Not from first.

So I searched and get these answers;

But in my project, it didn’t work! And I spent my time for solve this problem a while.

Situation is this. I’m creating a Rockman(Megaman) game.

And I have to implement when the character Zero use his saber while falling,

the falling_shot animation starts from the frame.

Watch this picture to help you explain what I have to do.

It is simple question. If I can access each frame directly with Animation array’s index,

what I have to do is just set the playing index to next frame’s index. It’s not hard.

But in Unity, I cannot access Animation components directly

and I found that I have to use operator this like;

// set start frame with time 0.5
animation["JumpShotA"].time = 0.5f;

However it didn’t work. Here’s my code that playing animation “JumpShotAir”.

It’s not the code that change animations frame, but just plays JumpShotAir animation.

using UnityEngine;
using System.Collections;

public class ZController : MonoBehaviour {
    Animator _animator;

	// Use this for initialization
	void Start () {
        _animator = GetComponent<Animator>();
        var animation = GetComponent<Animation>();
        var jumpShotA = animation["JumpShotA"];
        animation.clip = jumpShotA.clip;
	// Update is called once per frame
	void Update () {

But this code results like this; message that NullReferenceException: GetRef error.


I really don’t know. What did I wrong? Is there any problem in my code?

Can I access Animation component’s array directly? How can I access it?

If you want to download my test project, check this out.

Test project. Links to Google drive.

Thanks for reading.


In Unity 4.x and 5.x animation desinged from unity is by default genric animation and need to use Animator to use animation in game.

you can use CrossFade mehthod to use jump one animation to another. here is link of Unity documention (Unity - Scripting API: Animator.CrossFade, Unity - Scripting API: Animator)

But there are not any option to start animation from any particular frame to match with other animation