Unity Button按钮延迟
1.把下面脚本放到Editor文件夹下,这样脚本继承Button之后,新声明的public变量才能在Inspector面板显示出来。
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.UI;
using UnityEngine; [CustomEditor(typeof(MyButton), true)]
[CanEditMultipleObjects]
public class MyButtonEditor : ButtonEditor
{
private SerializedProperty delayTime; protected override void OnEnable()
{
base.OnEnable();
delayTime = serializedObject.FindProperty("delayTime");
} public override void OnInspectorGUI()
{
base.OnInspectorGUI();
EditorGUILayout.Space();
serializedObject.Update();
EditorGUILayout.PropertyField(delayTime);
serializedObject.ApplyModifiedProperties();
}
}

2.把下面脚本当成Button组件用,在Inspector面板的delayTime输入想延迟的时间就行了。
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.UI;
using UnityEngine; [CustomEditor(typeof(MyButton), true)]
[CanEditMultipleObjects]
public class MyButtonEditor : ButtonEditor
{
private SerializedProperty delayTime; protected override void OnEnable()
{
base.OnEnable();
delayTime = serializedObject.FindProperty("delayTime");
} public override void OnInspectorGUI()
{
base.OnInspectorGUI();
EditorGUILayout.Space();
serializedObject.Update();
EditorGUILayout.PropertyField(delayTime);
serializedObject.ApplyModifiedProperties();
}
}

Unity Button按钮延迟的更多相关文章
- Unity中Button按钮的触发监听事件
第一种方式:需要把自己添加的Button按钮属性(Inspector)中的(Button)onclick添加方法. public void BtnCreteClick() { Debug.Log(&q ...
- button 按钮,结合onclick事件,验证和提交表单
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- 如何在MFC界面开发中响应Button按钮的Down和Up事件
通过尝试有两种方案可以解决这个问题,第一种方案是通过PreTranslateMessage函数在调度消息之前对消息类型进行筛选,第二种方案是重载CButton类,在重载后的类CForTestButto ...
- 遭遇input与button按钮背景图失效不显示的解决办法
笔者从事网页前端代码页面工程师已有多年,作为一个网页重构人员常常会遇到一些莫名其妙的DIV+CSS(正确的说法是XHTML+CSS)在 IE.FireFox火狐. 谷歌浏览器CHROME.苹果浏览器S ...
- button按钮
button按钮只加类名不加type时,点击此按钮页面会刷新
- Unity3D NGUI 给button按钮添加单间事件
Unity3D中, NGUI 给button按钮添加单间事件的方法很多,在这里只给推荐一种比较常用的方法. 推荐方法:使用UIListener. 1.给button组价添加上UIListener.选择 ...
- iphone中button按钮显示为圆形解决
iphone中button按钮显示为圆形解决: 添加样式: -webkit-appearance:button; 如果需要为直角: border-radius:0 在源码中添加如:style=&quo ...
- 【html】button按钮的一些问题
问题: button 按钮在不设置 type 属性时,在不同的浏览器作用不一样.举个例子: html: <!doctype html> <html lang="en&quo ...
- RFS_点击button按钮之后,RFS出现卡死的问题
[html代码] <html> <head> <title> 主窗口 </title> </head> <body> <d ...
随机推荐
- 梯度提升树GBDT总结
提升树的学习优化过程中,损失函数平方损失和指数损失时候,每一步优化相对简单,但对于一般损失函数优化的问题,Freidman提出了Gradient Boosting算法,其利用了损失函数的负梯度在当前模 ...
- No suitable constructor was found in NUnit Parameterised tests
No suitable constructor was found in NUnit Parameterised tests Fairly obvious, but can also happen i ...
- pytorch-VGG网络
VGG网络结构 第一层: 3x3x3x64, 步长为1, padding=1 第二层: 3x3x64x64, 步长为1, padding=1 第三层: 3x3x64x128, 步长为1, paddin ...
- Android下文件访问的权限
* 默认情况下,Android中,应用程序的文件时私有的,其他应用程序不可以读取私有的文件 * 底层用的时Linux文件的权限 - rw- rw- --- - :文件 ...
- 面向对语法读取mysql数据库数据例:$db->query($sql)、$result->fetch_array()
前面我们介绍过如何使用面向对象语法连接mysql数据库,今天技术人员继续讲解如何读取数据.虽然与以前面向过程类似,但还是有些不同,需要大家用心了解. echo '面向对象语法连接数据库test db ...
- 一百一十六:CMS系统之使用阿里大于sdk发送短信验证码
阿里大于短信平台:https://dysms.console.aliyun.com/dysms.htm#/overview 使用教程:https://blog.csdn.net/qq103189393 ...
- powershell获取mac地址
> getmac > getmac | select-string "00" > $a = getmac | select-string "00&quo ...
- 关于虚拟机可以ping通本机,本机可以ping通虚拟机,但是虚拟机就是不能上网
1 需要确定虚拟的防火墙已经关闭 2 修改vi /etc/sysconfig/network-scripts/ifcfg-eth0配置文件 增加以下参数 BOOTPROTO=none------- ...
- Python中第三方库Requests库的高级用法详解
Python中第三方库Requests库的高级用法详解 虽然Python的标准库中urllib2模块已经包含了平常我们使用的大多数功能,但是它的API使用起来让人实在感觉不好.它已经不适合现在的时代, ...
- Python3 编程第一步_斐波纳契数列_连续赋值
# Fibonacci series: 斐波纳契数列 # 两个元素的总和确定了下一个数 a, b = 0, 1 while b < 10: print(b) a, b = b, a+b # 1 ...