using UnityEngine;
using System.Collections;

public class setAnimationEvent : MonoBehaviour {

    public RuntimeAnimatorController m_runtimeAnimatorController;

    // Use this for initialization
    void Start () {
        m_runtimeAnimatorController = this.GetComponent<Animator>().runtimeAnimatorController;
        AnimationEvent newEvent = new AnimationEvent();
        newEvent.functionName = "print";
        newEvent.time = 0.2f;
        m_runtimeAnimatorController.animationClips[0].AddEvent(newEvent);
        Debug.Log(m_runtimeAnimatorController.animationClips.Length.ToString()); 
        this.GetComponent<Animator>().Rebind();
    }
    
    // Update is called once per frame
    void Update () {
    
    }

    void print()
    {
        Debug.Log("ssss");
    }
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-02
  • 2021-09-15
  • 2021-06-03
  • 2021-09-06
  • 2021-09-08
  • 2022-02-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案