-
Notifications
You must be signed in to change notification settings - Fork 324
/
Copy pathExample_74_GUISkin.cs
45 lines (40 loc) · 1.3 KB
/
Example_74_GUISkin.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace UnityToolchinsTrick
{
/// <summary>
/// 文档
/// https://www.jianshu.com/p/4b022fe9bffa
/// https://blog.csdn.net/sunny__chen/article/details/51323265
/// </summary>
public class Example_74_GUISkinWindow : EditorWindow
{
private static Example_74_GUISkinWindow _window;
private GUISkin _skin;
private GUIStyle _btn_style;
private GUIStyle _label_style;
[MenuItem("Tools/Example_74_GUISkinWindow", priority = 74)]
private static void PopUpWindow()
{
_window = GetWindow<Example_74_GUISkinWindow>("GUISkinWindow");
_window.Init();
_window.Show();
}
private void Init()
{
_skin = AssetDatabase.LoadAssetAtPath<GUISkin>(
"Assets/Editor/Examples/Example_74_GUISkin/GUISkin01.guiskin");
_btn_style = _skin.button;
_label_style = _skin.label;
}
private void OnGUI()
{
GUILayout.Label("鼠标悬停在下面的button上可以看到测试效果",_label_style);
if (GUILayout.Button("带有guiskin样式的按钮", _btn_style))
{
}
}
}
}