当前位置:网站首页>Unity editor expansion - the framework and context of unity imgui
Unity editor expansion - the framework and context of unity imgui
2022-07-03 08:26:00 【T.D.C】
Little knowledge
- Unity Based on IMGUI The design idea of ui Frame and use it to make UnityEditor
- In the early Unity Users of ui Also mostly used IMGUI Realization
- IMGUI Performance ratio ngui and ugui low , No one should use the new project now ngui 了
- Now? Unity A new ui programme , Integrate the past unity Officially supported ui
- I guess I'll leave the world ui The framework update is not far away , Another wave of technological progress
Unity IMGUI Framework
- stay Monobehaviour perhaps Window Defined in subclasses OnGUI Method , stay OnGUI Method can be used Unity Of api establish ui
- make carbon copies Editor Class OnInspectorGUI The method has a similar effect , This is often used to customize a Mono Script editor
Core class : create a window 、 Control , Make a layout , Modify the style
- EditorWindow, The custom window must be EditorWindow Subclasses of , Use GetWindow establish
- GUI, There is no automatic layout , You can create controls , You can set to get GUI The state of
- GUILayout, There is automatic layout , You can create controls
- GUILayoutUtility, Yes GUILayout expand
- EditorGUI, More functions GUI
- EditorGUILayout, More functions GUILayout
- EditorGUIUtility, Yes GUILayout Development of
- Handles, Painting in the scene 3D ui
- What does auto layout mean
- You can specify scalable size information to make the control layout automatically
- Use GUILayout Method creation under GUILayoutOption To set layout properties
- Create in the editor GUISkin, When you create a control, you can change the style by passing it to the control
example
- More examples can be found in the resources below unity Official documents found
using UnityEditor;
using UnityEngine;
namespace DC.DCIMGUIBox
{
public class LayoutAndAreaWindow_01 : EditorWindow
{
[MenuItem("DC/IMGUI/LayoutAndAreaWindow_01")]
public static void Open()
{
var window = GetWindow<LayoutAndAreaWindow_01>();
window.minSize = new Vector2(800, 600);
}
public void OnGUI()
{
GUILayout.BeginArea(new Rect(0, 0, 200, 200));
EditorGUI.DrawRect(new Rect(0, 0, 100, 100), Color.blue);
if (Event.current.type == EventType.MouseDown)
{
Debug.Log("box a" + Event.current.mousePosition);
}
GUILayout.EndArea();
GUILayout.BeginArea(new Rect(210, 0, 200, 200));
EditorGUI.DrawRect(new Rect(0, 0, 100, 100), Color.red);
if (Event.current.type == EventType.MouseDown)
{
Debug.Log("box b" + Event.current.mousePosition);
}
GUILayout.EndArea();
}
}
}
Reference material
- https://docs.unity3d.com/Manual/GUIScriptingGuide.html
边栏推荐
- What is BFC?
- Golang 时间格式整理
- 796 · 开锁
- Thymeleaf 404 reports an error: there was unexpected error (type=not found, status=404)
- Ilruntime learning - start from scratch
- Some understandings of 3dfiles
- Cesium for unreal quick start - simple scenario configuration
- Transfinite hacker cognition
- swagger文档配置
- Mall management system of database application technology course design
猜你喜欢

C language - Introduction - essence Edition - take you into programming (I)

Haproxy+kept build 01
![[updating] wechat applet learning notes_ three](/img/05/958b8d62d3a42b38ca1a2d8631a7f8.png)
[updating] wechat applet learning notes_ three

Simply start with the essence and principle of SOM neural network

the installer has encountered an unexpected error installing this package

Base64和Base64URL

Osgearth target selection

Multi traveling salesman problem -- overview of formula and solution process

Unity learning notes

梯度下降法求解BP神经网络的简单Demo
随机推荐
About the problem that the editor and the white screen of the login interface cannot be found after the location of unityhub is changed
Use of ue5 QRcode plug-in
php-fpm软件的安装+openresty高速缓存搭建
UE4 source code reading_ Bone model and animation system_ Animation compression
Golang 中string和int类型相互转换
Cesium service deployment, and import and display local 3dfiles data
Youyou1 of xlua knapsack system
[audio and video] ijkplayer error code
Swagger document configuration
Visual Studio (VS) shortcut keys
Shader foundation 01
数据分析练习题
MAE
基于SSM的校园失物招领平台,源码,数据库脚本,项目导入运行视频教程,论文撰写教程
C语言-入门-精华版-带你走进编程(一)
jupyter远程服务器配置以及服务器开机自启
Base64 and base64url
Display terrain database on osgearth ball
Cesium for unreal quick start - simple scenario configuration
Ilruntime learning - start from scratch