当前位置:网站首页>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
边栏推荐
- Exe file running window embedding QT window
- UE4 plug in development
- Detailed explanation of all transfer function (activation function) formulas of MATLAB neural network
- Mxone Pro adaptive 2.0 film and television template watermelon video theme apple cmsv10 template
- [public key cryptography] ECC elliptic cryptosystem (implementing ElGamal encryption method)
- Editor Extensions
- Unity one click AssetBundle
- Jupyter remote server configuration and server startup
- 【K&R】中文第二版 个人题解 Chapter1
- 2021-10-19
猜你喜欢

Base64 and base64url

Editor Extensions

Flex flexible box layout

C#课程设计之员工信息管理系统

Get to know unity2 for the first time

jupyter远程服务器配置以及服务器开机自启

Basic operation and process control 2

Dealing with duplicate data in Excel with xlwings

Osgearth target selection
![[cloud native] introduction and use of feign of microservices](/img/39/05cf7673155954c90e75a8a2eecd96.jpg)
[cloud native] introduction and use of feign of microservices
随机推荐
Swagger document configuration
OpenGL learning notes
Base64和Base64URL
LinkList
MAE
Dotween plug-in
Chain length value
matlab神經網絡所有傳遞函數(激活函數)公式詳解
Display terrain database on osgearth ball
Luaframwrok handles resource updates
P2622 light off problem II (state compression search)
Data analysis exercises
Compilation error: "not in executable format: file format not recognized"“
Golang's range
【K&R】中文第二版 个人题解 Chapter1
Haproxy+kept build 01
数据的存储
Unity4.3.1 engine source code compilation process
UE4 source code reading_ Mobile synchronization
Ue5 opencv plug-in use