Unity Invoke的另类用法
来源:互联网 发布:淘宝助手缓存清理 编辑:程序博客网 时间:2024/06/06 17:29
主要是invoke实现了替换颜色等功能。。
因为之前弄懂了点,现在又忘了,记录下,相关代码如下:
using System.Collections;
using System.Collections.Generic;using UnityEngine;
using UnityEngine.Events;
[System.Serializable] //序列化类
public class MyColorEvent : UnityEvent<Color>
{
}
[System.Serializable]
public class MyIntEvent : UnityEvent<Texture2D>
{ }
public class test : MonoBehaviour {
public MyColorEvent m_MyEvent = new MyColorEvent();
public MyIntEvent m_MyIntEvent = new MyIntEvent();
public Texture2D _T2D;
void Start()
{
//if (m_MyEvent == null)
// m_MyEvent = new MyIntEvent();
// m_MyEvent.AddListener(Ping);
}
void Update()
{
if (Input.anyKeyDown && m_MyEvent != null && m_MyIntEvent != null)
{
m_MyEvent.Invoke(Color.red);
m_MyIntEvent.Invoke(_T2D);
}
}
}
功能:
阅读全文
0 0
- Unity Invoke的另类用法
- unity ~ Invoke的使用
- #define 的另类用法
- WPE的另类用法
- WPE的另类用法
- overflow的另类用法
- RPM的另类用法
- new的另类用法
- printf的另类用法
- DataTable 的另类用法
- Decal的另类用法
- printf的另类用法
- Invoke的用法(C#)
- Invoke的用法
- Invoke的用法
- spring的invoke用法
- Invoke的用法
- unity invoke
- 非常可乐
- maven安装以及eclipse配置新建maven项目
- CNTK入门04: CNTK中的Sequences
- USB接口接线说明
- [译][转]Google的Java编程风格指南(Java编码规范)
- Unity Invoke的另类用法
- UNIX命令行快速入门7
- LifecycleProcessor not initialized
- redis密码管理
- 关于webview加载h5提示当前网站证书不可信的一些处理方法
- PB怎么用代码修改DW的字体的属性
- Web app root system property already set to different value: 'webapp.root'
- leetcode 9 回文数
- 索尼:声控将在VR中发挥大作用