Icons

Icon provider system for the Paragon Editor. Exposes cached Texture2D icons from three sources — custom Paragon atlas icons, Odin Inspector (Sirenix) editor and SDF icons, and built-in Unity editor icons — through a unified DrawGUI.Icon API.

All icon providers are nested static classes within the DrawGUI.Icon partial class. Icons are lazily loaded and cached via the IconCache<TCache, TEnum> base class (defined in DrawGUI.Icon.cs), ensuring each texture is only created once.

Architecture

spinner

Data Flow

spinner

Providers

Provider
Source
Count
Cache
Description

Atlas texture

~290

IconCache

Custom project icons extracted from a sprite atlas

EditorIcons

~130

Direct proxy

Odin Inspector built-in editor icons

SdfIcons

~1500

IconCache

Odin SDF (Signed Distance Field) vector icons

EditorGUIUtility

~28

readonly

Built-in Unity editor textures

Quick Start

using Paragon.Editor;

// Paragon custom icons (cached, white by default)
Texture2D bugIcon = DrawGUI.Icon.Paragon.Bug;

// Paragon icon with custom color and size
Texture2D redBug = DrawGUI.Icon.Paragon.Create(ParagonIconType.BUG, Color.red, 32, 32);

// Sirenix SDF icons (cached)
Texture2D alarm = DrawGUI.Icon.Sirenix.SDF.Alarm;

// Sirenix SDF with custom color and padding
Texture2D blueAlarm = DrawGUI.Icon.Sirenix.SDF.Create(SdfIconType.Alarm, Color.blue, 32, 32, 2);

// Sirenix editor icons (EditorIcon with Active/Inactive states)
EditorIcon play = DrawGUI.Icon.Sirenix.Editor.Play;

// Unity built-in icons (readonly, loaded once)
Texture2D brush = DrawGUI.Icon.Unity.Brush;

Key Concepts

IconCache

All cacheable providers inherit from IconCache<TCache, TEnum>, which:

  • Stores textures in a Dictionary<TEnum, Texture2D>

  • Lazily creates textures on first access via the abstract Create(TEnum) method

  • Clears all caches on AssemblyReloadEvents.beforeAssemblyReload to prevent stale textures

  • Uses a standard icon size of 64×64 pixels (icon_size = 64)

Paragon Atlas

Paragon icons are packed into a single atlas texture (DrawGUI.Icon.Paragon.Atlas). Individual icons are extracted by computing grid coordinates from the ParagonIconType enum's integer value. The alpha channel from the atlas is combined with a tint color (default: white) to produce the final texture.

SDF Icons

SDF icons use Odin Inspector's SdfIcons.CreateTransparentIconTexture() which renders scalable vector icons at any size. The default color uses GUI.contentColor to match the current editor skin.

See Also

  • DrawGUI — Parent DrawGUI system overview

Last updated