unity, inspector listview
inspector中实现列表框:
public override void OnInspectorGUI(){
bool isDoubleClick=false;
Event e = Event.current;
if (e.type == EventType.mouseDown && Event.current.button == 0) {//left button down
if(e.clickCount==2){//double click
isDoubleClick=true;
}
}//got isDoubleClick
Rect scrollviewRect=EditorGUILayout.BeginVertical ();
{
scrollPosition = EditorGUILayout.BeginScrollView (scrollPosition, "box", GUILayout.Height (150));
{
//ref: http://answers.unity3d.com/questions/37223/how-do-i-center-a-gui-label.html
//ref: http://iaimstar.iteye.com/blog/2222128
GUIStyle _style = GUI.skin.GetStyle ("MenuItemMixed");
m_selectIndex = GUILayout.SelectionGrid (m_selectIndex, list.ToArray (), 1, _style);
}
EditorGUILayout.EndScrollView ();
if (scrollviewRect.Contains (e.mousePosition)) {
if(isDoubleClick){
Debug.Log(list[m_selectIndex]);
}
}
}
EditorGUILayout.EndVertical ();
}
unity, inspector listview的更多相关文章
- Unity Inspector面板常用的属性
在扩展Unity的时候,往往会用到一些属性,这里将常用的列一下. 1.属性只读: #if UNITY_EDITOR using UnityEditor; #endif using UnityEngin ...
- Unity Inspector添加自定义按钮(Button)
在Unity开发游戏的时候,为了有一个更快更方便的工作流,我们往往会在Editor下开发一些方便实用的工具.在工具中,用到最多,最关键的就是按钮,它是工具的首席执行官.下面就用最简单的代码来演示添加一 ...
- 扩展Unity Inspector
Unity Editor下,可以在不改变原有布局的情况下扩展Inspect的界面. 在继承了Editor的类中,有两种实现方式: using UnityEditor; [CustomEditor(ty ...
- Unity Inspector 给组件自动关联引用(二)
通过声明的变量名称,主动关联引用. 使用这个关联引用两种方式1. 给你组件继承 MonoAutoQuote 点击组件inspector 按钮执行2. 给你组件类添加[AAutoQuote] 特性 ...
- unity, inspector debug
以前经常因为脚本中private变量不在inspector界面中显示,不方便观察其值的变化,所以本该用private的用了public. 今天发现,原来inspector有个选项,如图,平常勾选的是N ...
- unity inspector 自动装载Commont和Prefab属性
在使用unity的过程中,经常遇到这样的问题:每次都需要手动为序列化属性拖拽赋值.像这样: 试着找了找,真的找到了一份代码,但是缺少自动装载Prefab的功能.之后我花了点时间添加这个功能. 使用方法 ...
- Unity Inspector 给组件自动关联引用
项目进入上线阶段了, 有一些地方需要总结和优化. 我发现UI一改变,我就要拖很久的UI. UI结构发生改变我还必须给一些变量设置好引用,后来我去看别人预设的时候组件拖放的变量至少10个以上, 它们一 ...
- 【Unity Shaders】Diffuse Shading——向Surface Shader添加properties
本系列主要参考<Unity Shaders and Effects Cookbook>一书(感谢原书作者),同时会加上一点个人理解或拓展. 这里是本书所有的插图.这里是本书所需的代码和资源 ...
- Unity检视面板的继承方法研究 (二)
之前做了普通对象的可继承的检视面板类, 现在想要实现对Unity自带的检视面板的继承的话, 要怎样写呢? 万变不离其宗, 仍然是围绕UnityEditor.Editor.CreateEditor 这 ...
随机推荐
- Install Tomcat 7 on CentOS, RHEL, or Fedora
linux下的 Tomcat 安装: http://www.davidghedini.com/pg/entry/install_tomcat_7_on_centos
- Openshift 3.11和LDAP的集成
1. OpenLDAP的安装 只记录主要步骤,详细可参考 https://access.redhat.com/solutions/2484371 # yum install -y openldap o ...
- ICLR 2013 International Conference on Learning Representations深度学习论文papers
ICLR 2013 International Conference on Learning Representations May 02 - 04, 2013, Scottsdale, Arizon ...
- Python学习 —— 阶段综合练习二
综合之前的类的学习,做以下实例练习:(建议先不要看代码,自己先试着写:代码仅供参考,有多种实现方法) 1. Triangle & Equilateral 1). 创建class Triang ...
- java如何判断编码是否是utf8编码
String的getBytes()方法是得到一个系统默认的编码格式的字节数组getBytes("utf-8") 得到一个UTF-8格式的字节数组 把String转换成bytes, ...
- django基础复习
Django - 路由系统 url.py - 视图函数 views.py - 数据库操作 models.py - 模板引擎渲染 - HttpReponse(字符串) - render(request, ...
- CSS 中的强制换行和禁止换行
强制换行 1.word-break: break-all; 只对英文起作用,以字母作为换行依据. 2.word-wrap: break-word; 只对英文起作 ...
- [Node.js] Level 5. Express
Express Routes Let's create an express route that accepts GET requests on'/tweets' and responds by s ...
- asp.net 输出微信自定义菜单json
这里使用LitJson.dll作json解析. 微信规定的自定义菜单json样式如下: { "button":[ { "type":"click&qu ...
- pring MVC过滤器-HttpPutFormContentFilter
在Spring MVC过滤器-HiddenHttpMethodFilter中我们提到,jsp或者说html中的form的method值只能为post或get,我们可以通过HiddenHttpMetho ...