gpt4 book ai didi

animation - 通过脚本更改动画 Controller

转载 作者:行者123 更新时间:2023-12-03 09:23:11 24 4
gpt4 key购买 nike

我可能有 2 个 Controller

1-ControllerBLUE.controller(默认)

2-ControllerRED.controller

如何从脚本更改 Controller

我尝试过:

var colorController = GetComponent(Animator);


colorController.runtimeAnimatorController = Resources.Load("main/colors/controllercolors/ControllerRED.controller ") as RuntimeAnimatorController;

但它不起作用,只是让动画 Controller 变为:“无(运行时动画 Controller )”

这可能吗?我怎样才能让它发挥作用?

最佳答案

抱歉,我在 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 () {

} }

关于animation - 通过脚本更改动画 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27329808/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com