【发布时间】:2016-01-01 06:47:59
【问题描述】:
我在“Assets/Resources/System/PLController”中有一个 Animator 控制器。我必须在运行时使用脚本添加它。如何做到这一点。使用 Unity 5 (5.3.0f4)
PLController =(动画控制器)
【问题讨论】:
我在“Assets/Resources/System/PLController”中有一个 Animator 控制器。我必须在运行时使用脚本添加它。如何做到这一点。使用 Unity 5 (5.3.0f4)
PLController =(动画控制器)
【问题讨论】:
首先将Animator 组件附加到GameObject 上
声明一个Animator 变量。
通过GetComponent分配变量
将RuntimeAnimatorController 分配给其runtimeAnimatorController 属性。
喜欢,
Animator PLAnimator;
void Start ()
{
PLAnimator = GetComponent<Animator> ();
PLAnimator.runtimeAnimatorController = Resources.Load ("Assets/Resources/System/PLController") as RuntimeAnimatorController;
}
【讨论】:
PLController.controller?