BCG_GUISkinTextureGeneratorWindow

Table of Contents

A comprehensive Unity Editor window for generating and customizing GUI textures programmatically. This tool enables developers to create consistent, professional-looking custom GUISkin assets with full control over colors, styles, effects, and texture generation.

Overview

The BCG_GUISkinTextureGeneratorWindow class is the primary user interface for the BCG GUISkin Generator package. It provides a multi-tabbed editor window where users can configure colors, element styles, visual effects, and generation options before producing a complete set of GUI textures that automatically integrate with Unity's GUISkin system.

PropertyValue
NamespaceBoneCrackerGames.GUISkinGenerator
InheritsEditorWindow
LocationAssets/BCG GUISkin Generator/Editor/BCG_GUISkinTextureGeneratorWindow.cs
Menu PathTools > BoneCracker Games > GUISkin Generator > Texture Generator Window
Minimum Size525 x 850 pixels

Architecture

Class Structure

The window follows a tabbed interface pattern with clearly separated concerns:


BCG_GUISkinTextureGeneratorWindow

├── UI State Management

│   ├── Tab navigation (selectedTab)

│   ├── Scroll position tracking

│   └── Foldout state persistence

├── Color Configuration

│   ├── Background colors (dark, medium, light)

│   ├── Accent colors (primary, hover, dark)

│   ├── Border colors (dark, light)

│   └── Text colors (normal, hover, disabled)

├── Element Style Configuration

│   ├── Button styles

│   ├── Toggle/checkbox styles

│   ├── Slider styles

│   ├── Scrollbar styles

│   ├── Text field styles

│   └── Window styles

├── Effect Configuration

│   ├── Gradient settings

│   ├── Highlight settings

│   ├── Shadow/glow settings

│   └── Noise texture settings

├── Texture Generation

│   ├── Drawing primitives

│   ├── Effect application

│   └── Asset management

└── Preset Management

    ├── EditorPrefs persistence

    └── JSON import/export

Static Instance Pattern

The window exposes a static Instance property for external access, particularly useful for the Live Preview window to read current color and style settings in real-time.


public static BCG_GUISkinTextureGeneratorWindow Instance { get; private set; }

User Interface Tabs

Quick Start Tab

The entry point for new users, providing a streamlined three-step workflow:

  1. Choose a Color Theme: Visual color preset swatches with one-click application
  2. Preview Your Theme: Simulated UI elements showing current settings
  3. Generate Textures: Guidance pointing to the bottom action bar

The Quick Start tab includes nine built-in color presets:

PresetPrimary Accent ColorDescription
Orange#FF8C00Default BoneCracker Games theme
Blue#0096FFProfessional blue accent
Green#4CAF50Material Design green
Red#F44336Material Design red
Purple#9C27B0Material Design purple
Cyan#00BCD4Teal/cyan accent
Pink#E91E63Material Design pink
Gold#FFC107Amber/gold accent
Unity#3E7DE7Unity Editor default blue

Colors Tab

Fine-grained control over all color values used in texture generation:

Background Colors

Accent Colors

Border Colors

Text Colors

Elements Tab

Configuration for individual UI element types:

Button Style

OptionDescription
FlatSimple solid fill with no depth effects
Raised3D embossed appearance with top highlight
Pressed3DInverted 3D effect for pressed appearance

Toggle/Checkbox Style

OptionDescription
CheckmarkClassic tick mark indicator
FilledSquareSolid square fill when checked
CircleFilled dot indicator
CrossX mark indicator

Scrollbar Thumb Style

OptionDescription
RoundedSoft rounded corners
SquareSharp square corners
PillFully rounded ends (capsule shape)

Effects Tab

Visual enhancement options for generated textures:

Gradient Settings

Top Highlight

Inner Shadow

Outer Glow

Noise Texture

Anti-Aliasing

Advanced Tab

Technical configuration for texture generation:

Texture Sizes (in pixels)

ElementDefaultRange
Button3216-64
Toggle1612-32
Field3216-64
Slider Thumb168-32
Slider Track124-24
Scrollbar158-24
Window6432-128
Dropdown Arrow128-20
Foldout Arrow128-20

Border & Corner Settings

9-Slice Border Settings

Generation Options

Paths & Presets

Texture Generation

Generated Texture Types

The window generates a complete set of GUI textures covering all standard Unity GUISkin elements:

Button Textures

Box Textures

Toggle Textures

Field Textures

Slider Textures

Scrollbar Textures

Window Textures

Drawing System

The texture generation uses a custom software rendering system with the following primitives:

MethodDescription
DrawRoundedRectFilled rectangle with configurable corner radius
DrawRoundedRectBorderOutlined rectangle with rounded corners
DrawCircleAnti-aliased filled circle
DrawCircleBorderAnti-aliased circle outline
DrawLineBresenham line with configurable thickness
DrawCheckmarkToggle checkmark indicator

Effect Application Pipeline

Effects are applied in a specific order to ensure correct visual layering:

  1. Outer Glow - Behind main shape
  2. Main Background - Base fill color
  3. Gradient Overlay - Depth shading
  4. 3D Effect - Raised/pressed appearance
  5. Inner Shadow - Inset appearance
  6. Noise Texture - Anti-banding pattern
  7. Border - Edge definition
  8. Top Highlight - Light reflection

Import Settings

Generated textures are automatically configured with optimal import settings:

SettingValueReason
Texture TypeGUIOptimized for UI rendering
NPOT ScaleNonePreserves exact dimensions
Filter ModeBilinearSmooth scaling
CompressionUncompressedPixel-perfect quality
MipmapsDisabledNot needed for UI
Alpha TransparencyEnabledRequired for UI elements
Wrap ModeClampPrevents edge artifacts
Max Size256Prevents unwanted downscaling

Preset System

EditorPrefs Persistence

Settings are automatically saved to Unity EditorPrefs when the window closes and restored when reopened. Persisted values include:

JSON Import/Export

The GeneratorPreset serializable class enables full configuration backup and sharing:


[System.Serializable]

private class GeneratorPreset {

    // Colors stored as HTML hex (RRGGBBAA)

    public string bgDark, bgMedium, bgLight;

    public string accent, accentHover, accentDark;

    // ... all other configuration values

}

Export creates a human-readable JSON file that can be version controlled or shared between team members.

Integration with Other Classes

BCG_GUISkinGeneratorUtility

Provides path management and folder structure utilities:

PropertyDescription
RootPathAuto-detected package root folder
GeneratedPathOutput folder for textures
DefaultGUISkinPathTarget GUISkin asset path

BCG_GUISkinSetup

Handles texture assignment to GUISkin assets:

BCG_GUISkinTextureGenerator

Static texture generation class (alternative to window-based generation):

Usage Example

Basic Workflow

  1. Open the window via Tools > BoneCracker Games > GUISkin Generator > Texture Generator Window
  2. Select a color preset from the Quick Start tab or customize colors in the Colors tab
  3. Adjust element styles in the Elements tab as needed
  4. Configure effects in the Effects tab
  5. Verify output path in the Advanced tab
  6. Click "Generate Textures" in the bottom action bar
  7. Textures are automatically assigned to the target GUISkin

Using Generated GUISkin in Code


// Load the generated GUISkin

GUISkin customSkin = Resources.Load<GUISkin>("BCG_DefaultGUISkin");



// Apply to GUI

void OnGUI() {

    GUISkin originalSkin = GUI.skin;

    GUI.skin = customSkin;



    // Draw your GUI elements

    if (GUILayout.Button("Custom Styled Button")) {

        // Handle click

    }



    GUI.skin = originalSkin;

}

Programmatic Access to Current Settings


// Access window instance for reading settings

var window = BCG_GUISkinTextureGeneratorWindow.Instance;

if (window != null) {

    Color currentAccent = window.Accent;

    int currentCornerRadius = window.CornerRadius;

    // Use values for custom rendering

}

Public API Reference

Public Properties (Read-Only)

PropertyTypeDescription
InstanceBCG_GUISkinTextureGeneratorWindowStatic singleton accessor
BgDarkColorCurrent dark background color
BgMediumColorCurrent medium background color
BgLightColorCurrent light background color
BorderDarkColorCurrent dark border color
BorderLightColorCurrent light border color
AccentColorCurrent primary accent color
AccentHoverColorCurrent hover accent color
AccentDarkColorCurrent dark accent color
TextColorColorCurrent text color
TextColorHoverColorCurrent hover text color
TextColorDisabledColorCurrent disabled text color
ButtonSizeintCurrent button texture size
ToggleSizeintCurrent toggle texture size
CornerRadiusintCurrent corner radius value
BorderThicknessintCurrent normal border thickness
HoverBorderThicknessintCurrent hover border thickness
ActiveBorderThicknessintCurrent active border thickness
SliderTrackHeightintCurrent slider track height
SliderThumbSizeintCurrent slider thumb size
FieldDarkeningfloatCurrent field background darkening
GUISkinPathstringCurrent target GUISkin path

Static Methods

MethodDescription
ShowWindow()Opens the editor window (menu item callback)

Troubleshooting

Common Issues

Textures not appearing after generation

Colors look different in game

9-slice stretching looks wrong

Textures have jagged edges

Version History

VersionChanges
2014-2026BoneCracker Games copyright range indicates long-term maintenance

Related Classes