BCG_GUISkinTextureGeneratorWindow
Table of Contents
- BCG_GUISkinTextureGeneratorWindow
- Overview
- Architecture
- Class Structure
- Static Instance Pattern
- User Interface Tabs
- Quick Start Tab
- Colors Tab
- Elements Tab
- Effects Tab
- Advanced Tab
- Texture Generation
- Generated Texture Types
- Drawing System
- Effect Application Pipeline
- Import Settings
- Preset System
- EditorPrefs Persistence
- JSON Import/Export
- Integration with Other Classes
- BCG_GUISkinGeneratorUtility
- BCG_GUISkinSetup
- BCG_GUISkinTextureGenerator
- Usage Example
- Basic Workflow
- Using Generated GUISkin in Code
- Programmatic Access to Current Settings
- Public API Reference
- Public Properties (Read-Only)
- Static Methods
- Troubleshooting
- Common Issues
- Version History
- Related Classes
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.
| Property | Value |
|---|---|
| Namespace | BoneCrackerGames.GUISkinGenerator |
| Inherits | EditorWindow |
| Location | Assets/BCG GUISkin Generator/Editor/BCG_GUISkinTextureGeneratorWindow.cs |
| Menu Path | Tools > BoneCracker Games > GUISkin Generator > Texture Generator Window |
| Minimum Size | 525 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:
- Choose a Color Theme: Visual color preset swatches with one-click application
- Preview Your Theme: Simulated UI elements showing current settings
- Generate Textures: Guidance pointing to the bottom action bar
The Quick Start tab includes nine built-in color presets:
| Preset | Primary Accent Color | Description |
|---|---|---|
| Orange | #FF8C00 | Default BoneCracker Games theme |
| Blue | #0096FF | Professional blue accent |
| Green | #4CAF50 | Material Design green |
| Red | #F44336 | Material Design red |
| Purple | #9C27B0 | Material Design purple |
| Cyan | #00BCD4 | Teal/cyan accent |
| Pink | #E91E63 | Material Design pink |
| Gold | #FFC107 | Amber/gold accent |
| Unity | #3E7DE7 | Unity Editor default blue |
Colors Tab
Fine-grained control over all color values used in texture generation:
Background Colors
bgDark: Base background for normal state elements (default:#2D2D2D)bgMedium: Hover state background (default:#3D3D3D)bgLight: Active/pressed state background (default:#4D4D4D)
Accent Colors
accent: Primary highlight color (default:#FF8C00)accentHover: Lighter accent for hover states (default:#FFA500)accentDark: Darker accent for pressed states (default:#C86E00)
Border Colors
borderDark: Normal state borders (default:#1A1A1A)borderLight: Inner borders and dividers (default:#5A5A5A)
Text Colors
textColor: Default label text (default:#E6E6E6)textColorHover: Interactive hover text (default:#FFFFFF)textColorDisabled: Disabled/inactive text (default:#808080)
Elements Tab
Configuration for individual UI element types:
Button Style
| Option | Description |
|---|---|
| Flat | Simple solid fill with no depth effects |
| Raised | 3D embossed appearance with top highlight |
| Pressed3D | Inverted 3D effect for pressed appearance |
Toggle/Checkbox Style
| Option | Description |
|---|---|
| Checkmark | Classic tick mark indicator |
| FilledSquare | Solid square fill when checked |
| Circle | Filled dot indicator |
| Cross | X mark indicator |
Scrollbar Thumb Style
| Option | Description |
|---|---|
| Rounded | Soft rounded corners |
| Square | Sharp square corners |
| Pill | Fully rounded ends (capsule shape) |
Effects Tab
Visual enhancement options for generated textures:
Gradient Settings
- Enable/disable gradient overlay
- Strength control (0.0 - 0.5)
- Direction options: TopToBottom, BottomToTop, LeftToRight, RightToLeft
Top Highlight
- Simulates light reflection at element top edge
- Configurable intensity, height, and color
Inner Shadow
- Creates inset appearance for elements
- Adjustable intensity and spread size
Outer Glow
- Glowing effect around element edges
- Configurable color, intensity, and size
Noise Texture
- Subtle noise pattern to reduce color banding
- Very low intensity values recommended (0.01-0.03)
Anti-Aliasing
- Quality levels: None, Low, Medium, High
- Higher quality produces smoother edges at slight performance cost
Advanced Tab
Technical configuration for texture generation:
Texture Sizes (in pixels)
| Element | Default | Range |
|---|---|---|
| Button | 32 | 16-64 |
| Toggle | 16 | 12-32 |
| Field | 32 | 16-64 |
| Slider Thumb | 16 | 8-32 |
| Slider Track | 12 | 4-24 |
| Scrollbar | 15 | 8-24 |
| Window | 64 | 32-128 |
| Dropdown Arrow | 12 | 8-20 |
| Foldout Arrow | 12 | 8-20 |
Border & Corner Settings
- Corner radius for rounded rectangles (0-16 pixels)
- Border thickness for normal, hover, and active states
9-Slice Border Settings
- Custom 9-slice border values for proper texture stretching
- Auto-calculate option based on corner radius
Generation Options
- Selective element generation (buttons, boxes, toggles, fields, etc.)
- Optional disabled state textures
- Optional focused state textures
- Auto-assign to GUISkin toggle
- Configure import settings toggle
Paths & Presets
- Output folder configuration
- Target GUISkin path
- JSON preset export/import for sharing configurations
Texture Generation
Generated Texture Types
The window generates a complete set of GUI textures covering all standard Unity GUISkin elements:
Button Textures
btn_normal.png- Default statebtn_hover.png- Mouse hover statebtn_active.png- Mouse pressed statebtnonnormal.png- Selected/toggle-on normalbtnonhover.png- Selected/toggle-on hoverbtnonactive.png- Selected/toggle-on pressedbtn_disabled.png- Disabled state (optional)
Box Textures
box_normal.png- Container backgroundbox_hover.png- Container hover statebox_focused.png- Keyboard focused (optional)
Toggle Textures
toggle_off.png- Unchecked statetoggle_on.png- Checked state with indicator
Field Textures
field_normal.png- Text input backgroundfield_hover.png- Text input hoverfield_focused.png- Text input with keyboard focusfield_disabled.png- Disabled text input (optional)
Slider Textures
slider_track.png- Background trackslidertrackfilled.png- Filled portion (optional)slider_thumb.png- Draggable handlesliderthumbhover.png- Handle hover statesliderthumbactive.png- Handle dragging state
Scrollbar Textures
scrollbar_track.png- Background trackscrollbar_thumb.png- Draggable thumbscrollbarthumbhover.png- Thumb hover statescrollbarthumbactive.png- Thumb dragging state- Arrow button textures (up, down, left, right with hover states)
Window Textures
window_bg.png- Panel/window background with optional title bar
Drawing System
The texture generation uses a custom software rendering system with the following primitives:
| Method | Description |
|---|---|
DrawRoundedRect | Filled rectangle with configurable corner radius |
DrawRoundedRectBorder | Outlined rectangle with rounded corners |
DrawCircle | Anti-aliased filled circle |
DrawCircleBorder | Anti-aliased circle outline |
DrawLine | Bresenham line with configurable thickness |
DrawCheckmark | Toggle checkmark indicator |
Effect Application Pipeline
Effects are applied in a specific order to ensure correct visual layering:
- Outer Glow - Behind main shape
- Main Background - Base fill color
- Gradient Overlay - Depth shading
- 3D Effect - Raised/pressed appearance
- Inner Shadow - Inset appearance
- Noise Texture - Anti-banding pattern
- Border - Edge definition
- Top Highlight - Light reflection
Import Settings
Generated textures are automatically configured with optimal import settings:
| Setting | Value | Reason |
|---|---|---|
| Texture Type | GUI | Optimized for UI rendering |
| NPOT Scale | None | Preserves exact dimensions |
| Filter Mode | Bilinear | Smooth scaling |
| Compression | Uncompressed | Pixel-perfect quality |
| Mipmaps | Disabled | Not needed for UI |
| Alpha Transparency | Enabled | Required for UI elements |
| Wrap Mode | Clamp | Prevents edge artifacts |
| Max Size | 256 | Prevents unwanted downscaling |
Preset System
EditorPrefs Persistence
Settings are automatically saved to Unity EditorPrefs when the window closes and restored when reopened. Persisted values include:
- All color values (as HTML hex strings)
- All size values
- Corner radius and border thickness
- Output and GUISkin paths
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:
| Property | Description |
|---|---|
RootPath | Auto-detected package root folder |
GeneratedPath | Output folder for textures |
DefaultGUISkinPath | Target GUISkin asset path |
BCG_GUISkinSetup
Handles texture assignment to GUISkin assets:
- Maps generated textures to appropriate GUIStyleState properties
- Supports fallback texture names when primary not found
- Records Undo operations for editor safety
BCG_GUISkinTextureGenerator
Static texture generation class (alternative to window-based generation):
- Can be called programmatically without UI
- Uses same drawing primitives and color palette
- Generates default orange theme textures
Usage Example
Basic Workflow
- Open the window via
Tools > BoneCracker Games > GUISkin Generator > Texture Generator Window - Select a color preset from the Quick Start tab or customize colors in the Colors tab
- Adjust element styles in the Elements tab as needed
- Configure effects in the Effects tab
- Verify output path in the Advanced tab
- Click "Generate Textures" in the bottom action bar
- 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)
| Property | Type | Description |
|---|---|---|
Instance | BCG_GUISkinTextureGeneratorWindow | Static singleton accessor |
BgDark | Color | Current dark background color |
BgMedium | Color | Current medium background color |
BgLight | Color | Current light background color |
BorderDark | Color | Current dark border color |
BorderLight | Color | Current light border color |
Accent | Color | Current primary accent color |
AccentHover | Color | Current hover accent color |
AccentDark | Color | Current dark accent color |
TextColor | Color | Current text color |
TextColorHover | Color | Current hover text color |
TextColorDisabled | Color | Current disabled text color |
ButtonSize | int | Current button texture size |
ToggleSize | int | Current toggle texture size |
CornerRadius | int | Current corner radius value |
BorderThickness | int | Current normal border thickness |
HoverBorderThickness | int | Current hover border thickness |
ActiveBorderThickness | int | Current active border thickness |
SliderTrackHeight | int | Current slider track height |
SliderThumbSize | int | Current slider thumb size |
FieldDarkening | float | Current field background darkening |
GUISkinPath | string | Current target GUISkin path |
Static Methods
| Method | Description |
|---|---|
ShowWindow() | Opens the editor window (menu item callback) |
Troubleshooting
Common Issues
Textures not appearing after generation
- Ensure the output path exists and is within the Assets folder
- Check that the target GUISkin asset exists at the configured path
- Verify "Auto-assign to GUISkin" is enabled
Colors look different in game
- Check project color space settings (Linear vs Gamma)
- Verify texture import settings are set to GUI type
9-slice stretching looks wrong
- Enable "Custom 9-Slice Borders" in Advanced tab
- Set border values to at least match the corner radius
Textures have jagged edges
- Increase Anti-Aliasing quality in Effects tab
- Ensure corner radius is appropriate for texture size
Version History
| Version | Changes |
|---|---|
| 2014-2026 | BoneCracker Games copyright range indicates long-term maintenance |
Related Classes
BCG_GUISkinTextureGenerator- Static texture generation without UIBCG_GUISkinGeneratorUtility- Path management utilitiesBCG_GUISkinSetup- GUISkin texture assignmentBCG_GUISkinLivePreviewWindow- Real-time preview (referenced but separate class)