当前位置:网站首页>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
边栏推荐
- String class
- Haproxy+kept build 01
- Transplantation of tslib Library
- Three characteristics
- 十六进制编码简介
- Compilation error: "not in executable format: file format not recognized"“
- About the problem that the editor and the white screen of the login interface cannot be found after the location of unityhub is changed
- Get to know unity2 for the first time
- 796 · 开锁
- E: Unable to locate package ROS melody desktop full
猜你喜欢
![[set theory] order relation (hastu example | divisive relation hastu | inclusive relation hastu | refinement relation hastu)](/img/de/1c75b5e7ed79aca47462de365428a7.jpg)
[set theory] order relation (hastu example | divisive relation hastu | inclusive relation hastu | refinement relation hastu)

Visual Studio (VS) shortcut keys

Base64编码简介

Editor Extensions

Creation of osgearth earth files to the earth ------ osgearth rendering engine series (1)

基于SSM的校园失物招领平台,源码,数据库脚本,项目导入运行视频教程,论文撰写教程

简易入手《SOM神经网络》的本质与原理

Puhua PLM empowers the whole scene product lifecycle management and helps the enterprise digital transformation of the main line of products

Base64 and base64url

Notes on understanding applets 2022/7/3
随机推荐
Base64 and base64url
Student educational administration management system of C # curriculum design
Gradle's method of dynamically modifying APK package name
Ilruntime learning - start from scratch
Cesium for unreal quick start - simple scenario configuration
About the problem that the editor and the white screen of the login interface cannot be found after the location of unityhub is changed
Mysql容器化(1)Docker安装MySQL
String class
Unity change default editor
Data analysis exercises
Osgearth topographic shading map drawing
Golang string segmentation, substitution and interception
ArrayList
Kunlunbase meetup is waiting for you!
the installer has encountered an unexpected error installing this package
Redis data structure
Solution détaillée de toutes les formules de fonction de transfert (fonction d'activation) du réseau neuronal MATLAB
Detailed explanation of all transfer function (activation function) formulas of MATLAB neural network
Storage of data
【云原生】微服务之Feign的介绍与使用