I have 2 Controllers may
1-ControllerBLUE.controller (Default)
2-ControllerRED.controller
How can I change the controller from script
I tried:
var colorController = GetComponent(Animator);
colorController.runtimeAnimatorController = Resources.Load("main/colors/controllercolors/ControllerRED.controller ") as RuntimeAnimatorController;
But it doesn't work it just make the animator controller to : "None (Runtime Animator Controller)"
Is it possible ? How can I make it work ?
I'm sorry, I use C# in Unity:
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 () {
} }