当前位置:网站首页>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 :
边栏推荐
- 【历史上的今天】7 月 2 日:BitTorrent 问世;商业系统 Linspire 被收购;索尼部署 PlayStation Now
- What should we pay attention to in the development process of Yingguang single chip microcomputer?
- 体验一下阿里云文字识别OCR
- Ora-19838 -- restore control files to the standby database
- Modbus protocol communication exception
- Yingguang single chip microcomputer pms150/pmc150/pms150c consumer single chip microcomputer
- 原装应广单片机 MCU芯片PMS152 SOP8封装 单片机开发
- Asemi rectifier bridge umb10f parameters, umb10f specifications, umb10f package
- Songhan sn8p2511 sop8 single chip microcomputer can be used for burning, providing single chip microcomputer scheme development and single chip microcomputer decryption
- [golang | grpc] generate certificates using OpenSSL
猜你喜欢

finally详解

自定义一个loading指令

深入理解ThreadLocal

Laravel框架安装时遇到的坑

aloam 代码阅读与总结

From a professional background, I can't get into a small company for interview

Experience Alibaba cloud character recognition OCR

如何下载微信支付证书(API证书)

Intelligent hydropower meter energy consumption monitoring cloud platform

Laravel文档阅读笔记-Custom Authentication Login And Registration Using Laravel 8
随机推荐
PMS150C应广单片机开发案例
Ora-19838 -- restore control files to the standby database
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
Many scenic spots are temporarily closed due to the typhoon. The provincial culture and tourism department reminds you to pay attention to safety!
Typescript
自定义一个loading指令
ASEMI整流桥UMB10F参数,UMB10F规格,UMB10F封装
uva1169
把xshell连接服务器关掉,运行的jar包就自动停止的解决方案
Easyai notes - deep learning
Solution pour arrêter automatiquement les paquets Jar en cours d'exécution en éteignant le serveur de connexion xshell
Mysql - opérations de base de la base de données
Mb10m-asemi rectifier bridge mb10m
Pfc232-sop8/14/16 should be wide-ranging and can be tape programmed with burning program
[nonlinear control theory]7_ High gain and High Frequency
ORA-19838 -- 恢复控制文件到备库
Redisson 高性能 Redis 分布式锁源码分析
Linux中,mysql设置job任务自动启动
蓝牙技术|物联网的可穿戴设备新工作模式,蓝牙BLE助力新工作模式
松翰SN8P2511 SOP8单片机 可代烧录 提供单片机方案开发 单片机解密