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[].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");
}
}

给animator动态添加事件的更多相关文章

  1. js动态添加事件-事件委托

    作者:白狼 出处:http://www.manks.top/javascript-dynamic-event.html 本文版权归作者,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给 ...

  2. js动态添加事件

    转载的,但不明确出处 往往我们需要在 JS 中动态添加事件,这就涉及到浏览器兼容性问题了,以下谈及的几种方法,我们也常常混合使用.方法一.setAttributevar obj = document. ...

  3. UGUI Button和Toogle动态添加事件

    如果你想动态创建Button和Toogle 等等一系列控件,需要动态添加事件的如下. 拿button和Toogle抛砖引玉O(∩_∩)O~ using UnityEngine; using Syste ...

  4. js实现动态添加事件

    js实现动态添加事件 一.实例描述 前一个案例讲了如何在网页中动态添加元素,有时候我们需要添加事件.本例学习如何动态的为元素添加事件. 二.截图 三.代码 <!DOCTYPE html> ...

  5. JS——动态添加事件和移除事件(有待补充...)

    动态的添加事件:利用 attachEvent 和 addEventListener IE 支持 attachEvent: obj.attachEvent("onclick", Fo ...

  6. js给div动态添加控件,然后给这个控件动态添加事件

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx. ...

  7. js中关于动态添加事件,不能使用循环变量的问题

    在编写事件的时候,我们难免会遇到以下这种情况:<!DOCTYPE html><html lang="en"><head> <meta ch ...

  8. Unity3D Animator控制参数和添加事件

    Animator控制参数和添加事件 using UnityEngine; using System.Collections; public class AniControl : MonoBehavio ...

  9. 移动端,ajax 动态加载的元素,为动态添加的一系列同个类名的元素添加点击事件

    背景:一个列表页,有一系列同类名的元素,需要为每一个动态添加的列表项添加事件: 点击选择下图中不同的文档类型,再通过 ajax 动态加载不同的文档. 使用过的方法: 1.通知 jquery 的 $(s ...

随机推荐

  1. ASP.NET MVC 下拉列表使用小结

    ASP.NET MVC中下拉列表的用法很简单,也很方便,具体来说,主要是页面上支持两种Html帮助类的方法:DropDownList()和DropDownListFor().这篇博文主要作为个人的一个 ...

  2. WinDbg 命令三部曲:(二)WinDbg SOS 扩展命令手册

    本文为 Dennis Gao 原创技术文章,发表于博客园博客,未经作者本人允许禁止任何形式的转载. 系列博文 <WinDbg 命令三部曲:(一)WinDbg 命令手册> <WinDb ...

  3. C++11 并发指南六(atomic 类型详解三 std::atomic (续))

    C++11 并发指南六( <atomic> 类型详解二 std::atomic ) 介绍了基本的原子类型 std::atomic 的用法,本节我会给大家介绍C++11 标准库中的 std: ...

  4. [汇编] 将字符串里的一个'&'字符换成空格

    ; multi-segment executable file template. data segment ; add your data here! pkey db "press any ...

  5. [BTS] Error biztalk arguments null exception string reference not set to an instance of a string. parameter name

    biztalk arguments null exception string reference not set to an instance of a string. parameter name ...

  6. Qt5.3 打印示例时出现错误

    说明:今天我在用Qt5.3写打印文档的时候,编译出错了,出错代码为: C:\Users\joe\Desktop\5-9\myPrint\mainwindow.cpp:35: error: undefi ...

  7. 基于RequireJS和JQuery的模块化编程——常见问题解析

    由于js的代码逻辑越来越重,一个js文件可能会有上千行,十分不利于开发与维护.最近正在把逻辑很重的js拆分成模块,在一顿纠结是使用requirejs还是seajs的时候,最终还是偏向于requirej ...

  8. js随机点名

    定时器案例. <!-- Author: XiaoWen Create a file: 2016-12-08 12:27:32 Last modified: 2016-12-08 12:51:59 ...

  9. iOS开发- 三步快速集成社交化分享工具ShareSDK

    1.前言 作为现在App里必不可少的用户分享需要,社交化分享显然是我们开发app里较为常用的. 最近因为公司App有社交化分享的需要,就特此研究了会,拿出来与大家分享. 想要集成社交会分享,我们可以使 ...

  10. hdu1879 继续畅通工程

    http://acm.hdu.edu.cn/showproblem.php?pid=1879 New~ 欢迎“热爱编程”的高考少年——报考杭州电子科技大学计算机学院关于2015年杭电ACM暑期集训队的 ...