播放骨骼动画

来源:互联网 发布:程序员需要学什么语言 编辑:程序博客网 时间:2024/06/07 07:07
public GameObject playActor;

void Start()
{
       Animation animation = playActor.GetComponent<Animation>();
       GameObject runGameObject = (GameObject)Resources.Load("Objects/Model/Objects/nvzhang/Anim/nvzhang@run");
       AnimationClip animationClip = runGameObject.GetComponent<Animation>().clip;
       animation.AddClip(animationClip, "run");

       AnimationState animationState = animation["run"];
       animationState.wrapMode = WrapMode.Loop;

       animation.Play("run");
}
0 0