Last active
April 29, 2023 09:35
-
-
Save RimuruDev/a906c77914fd424137403e0a1bef7f45 to your computer and use it in GitHub Desktop.
Drawing icons in Unity custom panel #RimuruDev
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEditor; | |
using UnityEngine; | |
// The script must be in the Editor folder | |
public sealed class IconPreviewWindow : EditorWindow | |
{ | |
[MenuItem("RimuruDevTool/Icon Preview")] | |
private static void Initialization() | |
{ | |
var window = (IconPreviewWindow)GetWindow(typeof(IconPreviewWindow)); | |
window.Show(); | |
} | |
private void OnGUI() | |
{ | |
DrawIconContent("_Help@2x"); | |
DrawIconContent("YUJECK"); | |
DrawIconContent("Exploit"); | |
DrawIconContent("Fox_Void"); | |
DrawIconContent("Mivioon"); | |
DrawIconContent("Алексей"); | |
DrawIconContent("Вестник-Шевцова"); | |
DrawIconContent("ПодвальныйЧат"); | |
} | |
// Images with name.png extension must be in Assets\Editor Default Resources\Icons folder | |
private void DrawIconContent(string name) | |
{ | |
var content = EditorGUIUtility.IconContent(name); | |
GUILayout.Label(content); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Materials