zoukankan      html  css  js  c++  java
  • 给animator动态添加事件

    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");
        }
    }
  • 相关阅读:
    Day 03
    Day 03 作业
    Day 02 作业
    Day 02
    Day 01
    Day 10 面向对象基础
    Spring学习-- Bean 的作用域
    一、基本知识
    cloud-init使用技巧
    如何在KVM中管理存储池
  • 原文地址:https://www.cnblogs.com/softimagewht/p/4942032.html
Copyright © 2011-2022 走看看