我有2个控制器可能
1-ControllerBLUE.controller(默认)
2-ControllerRED.controller
如何从脚本
更改控制器我试过了:
var colorController = GetComponent(Animator);
colorController.runtimeAnimatorController = Resources.Load("main/colors/controllercolors/ControllerRED.controller ") as RuntimeAnimatorController;
但它不起作用它只是让动画师控制器:“无(运行时动画控制器)”
有可能吗?我怎样才能使它工作?
答案 0 :(得分:3)
对不起,我在Unity中使用C#:
using UnityEngine;
using System.Collections;
public class ChangeController : MonoBehaviour {
Animator animator;
// Use this for initialization
void Start () {
animator = gameObject.GetComponent<Animator>();
animator.runtimeAnimatorController = Resources.Load("main/colors/controllercolors/ControllerRED") as RuntimeAnimatorController;
}
// Update is called once per frame
void Update () {
} }