DrawGUI

Unified IMGUI drawing API for the Paragon Editor. DrawGUI is a single static partial class split across multiple files, providing drawing primitives, layout scopes, style presets, and an icon caching system. All editor GUI in the Paragon framework is drawn through this API.

Architecture

spinner

Scope Usage Flow

spinner

Partial Class Structure

DrawGUI is a single static partial class split across 4 core files, plus subsystem files in Icons/ and Scopes/:

File
Contains
Description

Drawing methods

Labels, buttons, text fields, selectors, separators, progress indicators, debug rects

Style nested class

Pre-configured GUIStyle constants for consistent editor appearance

Scope nested class

Abstract base for IDisposable layout scopes with push/chain support

Icon nested class + IconCache

Icon caching infrastructure with abstract cache and generic typed cache

Subsystems

The following subsystems extend DrawGUI with additional partial class members and are documented separately:

Subsystem
Folder
Description

Icons

Icons/

Icon provider implementations — Paragon custom icons (atlas-based), Sirenix Editor/SDF icons, Unity built-in icons

Scopes

Scopes/

Concrete Scope implementations — layouts, toolbars, boxes, colorize, fade groups, style modifiers

Icons Subsystem (Icons/)

Three icon providers, each extending DrawGUI.Icon as a nested static class:

Provider
File(s)
Access Pattern

Paragon

DrawGUI.Icon.Paragon.cs, DrawGUI.Icon.Paragon.Type.cs

DrawGUI.Icon.Paragon.Checkmark — 200+ custom icons from a texture atlas

Sirenix

DrawGUI.Icon.Sirenix.Editor.cs, DrawGUI.Icon.Sirenix.SDF.cs

DrawGUI.Icon.Sirenix.Editor(...) / DrawGUI.Icon.Sirenix.SDF(...)

Unity

DrawGUI.Icon.Unity.cs

DrawGUI.Icon.Unity.Get(...) — Unity's built-in editor icons

Scopes Subsystem (Scopes/)

Concrete scope implementations, each adding factory methods to DrawGUI:

Scope
Factory Method
Purpose

HorizontalLayout

DrawGUI.HorizontalLayout()

EditorGUILayout.BeginHorizontal/EndHorizontal

VerticalLayout

DrawGUI.VerticalLayout()

EditorGUILayout.BeginVertical/EndVertical

HorizontalToolbar

DrawGUI.HorizontalToolbar()

Toolbar-styled horizontal group

VerticalToolbar

DrawGUI.VerticalToolbar()

Toolbar-styled vertical group

Box

DrawGUI.Box()

Help-box styled container

BoxHeader

DrawGUI.BoxHeader()

Box with header label

Colorize

DrawGUI.Colorize()

Temporarily changes GUI color

FadeGroup

DrawGUI.FadeGroup()

Animated expand/collapse

FlexibleSpace

DrawGUI.FlexibleSpace() (scope ver.)

Flexible space scope

ReadonlyIf

DrawGUI.ReadonlyIf()

Conditionally disables GUI

StyleWithBorder

DrawGUI.StyleWithBorder()

Temporarily modifies border

StyleWithMargin

DrawGUI.StyleWithMargin()

Temporarily modifies margin

StyleWithPadding

DrawGUI.StyleWithPadding()

Temporarily modifies padding

Quick Start

Key Concepts

Scope Chaining

Scopes support a Push() method that chains multiple scopes into a single using block. When disposed, pushed scopes are unwound in LIFO order before the outer scope ends. Extension methods on Scope (e.g., .HorizontalLayout()) make chaining fluent.

Icon Caching

All icons are lazily loaded and cached. The IconCache<TCache, TEnum> base class provides a dictionary-based cache keyed by an enum. Caches are automatically cleared on AssemblyReloadEvents.beforeAssemblyReload to prevent stale textures.

Style Presets

DrawGUI.Style provides pre-configured GUIStyle instances built from GUI.skin and EditorStyles. These use Odin's GUIStyle extension methods (WithAlignment, WithFontStyle, WithFontSize, etc.) for fluent construction.

Last updated