Skip to content

Instantly share code, notes, and snippets.

@RimuruDev
Last active April 29, 2023 09:35
Show Gist options
  • Save RimuruDev/a906c77914fd424137403e0a1bef7f45 to your computer and use it in GitHub Desktop.
Save RimuruDev/a906c77914fd424137403e0a1bef7f45 to your computer and use it in GitHub Desktop.
Drawing icons in Unity custom panel #RimuruDev
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);
}
}
@RimuruDev
Copy link
Author

Materials

Алексей
Вестник-Шевцова
ПодвальныйЧат
Exploit
Fox_Void
Mivioon
YUJECK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment