动态更换animator的animatorcontroller

你可以这样

 Animator animator = this.gameObject.GetComponent<Animator>();
 animator.runtimeAnimatorController = Resources.Load("path_to_your_controller") as RuntimeAnimatorController;

也可以这样

public RuntimeAnimatorController anim2;
this.GetComponent().runtimeAnimatorController = anim2 as RuntimeAnimatorController;

 

posted @ 2017-12-19 12:55  叫我张先生  阅读(1457)  评论(0编辑  收藏  举报