using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Anim1 : MonoBehaviour
{
public RuntimeAnimatorController rac;
public Button btn;
public AnimatorOverrideController aoc;
// Start is called before the first frame update
void Start()
{
rac=GetComponent<Animator>().runtimeAnimatorController;
aoc=new AnimatorOverrideController();
aoc.runtimeAnimatorController = null;
aoc.runtimeAnimatorController = rac;
GetComponent<Animator>().runtimeAnimatorController = aoc;
btn.onClick.AddListener(() =>
{
SetAnim("Anim/回旋跳斩");
GetComponent<Animator>().SetTrigger("play");
});
}
// Update is called once per frame
void Update()
{
}
public void SetAnim(string path)
{
if ( aoc != null)
{
aoc["平砍"]=Resources.Load<AnimationClip>(path);
}
}
}