当前位置:网站首页>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 :
边栏推荐
- wait_ for_ Gap -- restore archive from primary archive to secondary Archive
- [how to connect the network] Chapter 5 explore the server
- wps插入图片后使图片完整显示
- 王者荣耀商城异地多活架构设计
- Editor编辑器扩展在Scene View添加按钮和logo
- Clé de cartographie vimium
- Virtual lab basic experiment tutorial -7 Polarization (1)
- 辉芒微IO单片机FT60F010A-URT
- MySQL进阶-事务及索引
- Unified interface for reading and writing data files in xml/json/ini and ubjson formats
猜你喜欢
自定义一个loading指令
我的创作纪念日
MySQL -- basic operation of 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
Troubleshooting ideas that can solve 80% of faults
WPS inserts a picture and displays it completely
好玩的免费GM游戏整理汇总
Virtual lab basic experiment tutorial -7 Polarization (2)
【Golang | gRPC】使用gRPC实现简单远程调用
Mb10m-asemi rectifier bridge mb10m
随机推荐
Taiwan Feiling fm8pb513b MCU provides MCU program development product design
Virtual lab basic experiment tutorial -7 Polarization (1)
应广单片机PMS150/PMC150/PMS150C消费类单片机
自定义一个loading指令
977. Square of ordered array
Longest non repeating subarray
Wasserstein Slim GAIN with Clipping Penalty(WSGAIN-CP)介绍及代码实现——基于生成对抗网络的缺失数据填补
Yingguang single chip microcomputer pms150/pmc150/pms150c consumer single chip microcomputer
From a professional background, I can't get into a small company for interview
HDU - 1114 Piggy Bank (full backpack)
好玩的免费GM游戏整理汇总
vimium映射鍵
王者荣耀商城异地多活架构设计
Alibaba cloud sub account - Permission Policy - full control permission granted to an account and an OSS bucket
Graduation summary
MB10M-ASEMI整流桥MB10M
My creation anniversary
Develop a controller that prohibits deleting namespaces
aloam 代码阅读与总结
Hbuilderx runs to the mobile phone or simulator and prompts that the device is not found