当前位置:网站首页>Editor Editor Extension add button and logo in scene view
Editor Editor Extension add button and logo in scene view
2022-07-02 18:02:00 【avi9111】
Recently I found a wonderful lego project ,
It can be done very simply , Mario 64 Horizontal plate like that 3D Clearance game
In fact, this project is also unity The official template has appeared for a long time , Just have been practicing in the mountains , With very limited knowledge and scanty information
After reading this project logo I really like

So let's make one today
1) The first is inheritance Editor Window
2) And then like this ........ You can't

3) I wanted to Editor.OnSceneUI, But we still use the more kernel directly . SceneView
void OnEnable()
{
SceneView.duringSceneGui += SceneGUI;
}
void OnDisable()
{
SceneView.duringSceneGui -= SceneGUI;
}4, In limine scenView It fails to work well , Later, I found that my brother's article got the answer ( The following reference links )
At first, my brother also used the wrong , Various Canvas GUIContent Plan try , Then he succeeded
void SceneGUI(SceneView view)
{
// In the wrong
if (GUILayout.Button("fdsafadsf"))
{
}
// It's still wrong
GUI.Button(new Rect(10,10,100,100),"11111111");
}5)
// binding duringSceneGui Etc. code omitted , See github engineering
private void SceneGUI(SceneView view)
{
Handles.BeginGUI();6) Oh , by the way , Later used , Inherit Editor, Of OnSceneGUI, It didn't succeed at all .....
I don't know if it's a new version Unity2020 The problem of
7) The final full code
SceneView Of GUI, Just like ordinary OnGui() It's a little different ,GUILayout, EditorGUILayout These help classes , I can only use less
// copyright (c) by [email protected]
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
public class LolToolsWindows : EditorWindow
{
[MenuItem("Tools/Lol/Animation Window")]
public static void ShowWnd()
{
GetWindow<LolToolsWindows>().Show();
}
void OnEnable()
{
SceneView.duringSceneGui += SceneGUI;
}
private void OnGUI()
{
if (GUILayout.Button((" establish Animation in Scene")))
{
var go = GameObject.Find("LolSceneView");
if (go == null)
{
go = new GameObject("LolSceneView");
}
if (go.GetComponent<LolSceneMono>() == false)
{
go.AddComponent<LolSceneMono>();
}
Selection.activeObject = go;
}
}
void OnDisable()
{
SceneView.duringSceneGui -= SceneGUI;
}
void SceneGUI(SceneView view)
{
//c Reference resources :https://zhuanlan.zhihu.com/p/124269658
Handles.BeginGUI();
GUILayout.BeginArea(view.position); // Specify the display area as the screen size
if (GUILayout.Button("fdsafadsf"))
{
}
GUI.Button(new Rect(10,10,100,100),"11111111");
GUILayout.EndArea();
Handles.EndGUI();
}
}
Reference resources :
边栏推荐
- 基数排序的简单理解
- Modbus协议通信异常
- WPS inserts a picture and displays it completely
- How to download wechat payment certificate (API certificate)
- Design of the multi live architecture in different places of the king glory mall
- Atcoder beginer contest 237 VP supplement
- 松翰SN8P2511 SOP8单片机 可代烧录 提供单片机方案开发 单片机解密
- win10 kms activator
- 能解决 80% 故障的排查思路
- 科班出身,面试小公司都进不去
猜你喜欢

求求你们,别再刷 Star 了!这跟“爱国”没关系!

Deep understanding of ThreadLocal

Keras深度学习实战——基于VGG19模型实现性别分类

科班出身,面试小公司都进不去

The price is only 40 yuan. Pico development board of raspberry pie is added with WiFi module, and it is out of stock as soon as it comes into the market

Mb10m-asemi rectifier bridge mb10m

体验一下阿里云文字识别OCR

Ora-19838 -- restore control files to the standby database

详解Kubernetes网络模型

Explain kubernetes network model in detail
随机推荐
Problems needing attention in the development and debugging of Yingguang single chip microcomputer
977.有序数组的平方
Bluetooth technology | new working mode of wearable devices of the Internet of things, and Bluetooth ble helps the new working mode
义隆EM78P153K DIP14单片机 MCU
Development of original Yingguang MCU chip pms152 sop8 encapsulated MCU
Turn off the xshell connection server and the running jar package will stop automatically
MySQL --- 数据库的基本操作
Yingguang MCU development case
MySQL -- basic operation of database
Android cycle timer implementation, to achieve fixed Android cache cleaning
辉芒微IO单片机FT60F11F-MRB
Ora-19838 -- restore control files to the standby database
透过华为军团看科技之变(六):智慧公路
能解决 80% 故障的排查思路
Does pytorch support 32 bits?
Easyai notes - deep learning
应广单片机PMS150/PMC150/PMS150C消费类单片机
[nonlinear control theory]8_ Comparison of three robust controllers
Wasserstein Slim GAIN with Clipping Penalty(WSGAIN-CP)介绍及代码实现——基于生成对抗网络的缺失数据填补
Yingguang single chip microcomputer development specification pmc131 with AD chip to detect battery voltage single chip microcomputer sop8/14