Class HudTheme

Namespace
TDMaker.Unity.Hud
Assembly
TDMaker.Unity.dll

Look of the production HUD and of the world-space feedback (ranges, rally, aim). Every sprite slot is optional: empty slots use generated sprites from HudSprites. Create one with Assets/Create/2D Tower Defense Maker/HUD Theme and assign it to GameHud.

[CreateAssetMenu(menuName = "2D Tower Defense Maker/HUD Theme", fileName = "HudTheme", order = 40)]
public sealed class HudTheme : ScriptableObject
Inheritance
Object
ScriptableObject
HudTheme
Inherited Members
ScriptableObject.SetDirty()
ScriptableObject.CreateInstance<T>()
Object.GetEntityId()
Object.GetInstanceID()
Object.GetHashCode()
Object.InstantiateAsync<T>(T)
Object.InstantiateAsync<T>(T, Transform)
Object.InstantiateAsync<T>(T, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion, Transform)
Object.Instantiate(Object)
Object.Instantiate(Object, Scene)
Object.Instantiate<T>(T, InstantiateParameters)
Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
Object.Instantiate(Object, Transform)
Object.Instantiate<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Destroy(Object)
Object.DestroyImmediate(Object)
Object.DontDestroyOnLoad(Object)
Object.DestroyObject(Object)
Object.FindObjectsOfType<T>()
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindObjectOfType<T>()
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Object.FindObjectsByType<T>()
Object.FindObjectsByType<T>(FindObjectsInactive)
Object.ToString()
Object.name
Object.hideFlags

Constructors

HudTheme()

public HudTheme()

Fields

accentColor

Titles and highlights.

public Color accentColor

Field Value

Color

bannerSize

Banner size in reference pixels.

public Vector2 bannerSize

Field Value

Vector2

barBackColor

Bar background.

public Color barBackColor

Field Value

Color

barSprite

9-sliced bar (health, experience).

public Sprite barSprite

Field Value

Sprite

bodyFontWeight

Font weight of body labels; bold headings use the font asset's bold weight entry.

public FontWeight bodyFontWeight

Field Value

FontWeight

buildRingColor

Tint of the ring behind the radial build menu.

public Color buildRingColor

Field Value

Color

buttonColor

Button tint.

public Color buttonColor

Field Value

Color

buttonDisabled

Unavailable button.

public Color buttonDisabled

Field Value

Color

buttonFontWeight

Font weight of button titles; supply matching faces in the font asset's weight table.

public FontWeight buttonFontWeight

Field Value

FontWeight

buttonFrameColor

Trim drawn over every rectangular button (a thin rounded frame; transparent = no trim, the classic look). With a trim, an empty buttonSprite uses a flat generated face so the trim draws the edge.

[Header("Controls (optional)")]
[Tooltip("Thin frame drawn around rectangular buttons. Transparent = no frame.")]
public Color buttonFrameColor

Field Value

Color

buttonFrameSprite

9-sliced frame sprite for buttonFrameColor; empty uses a generated rounded frame.

public Sprite buttonFrameSprite

Field Value

Sprite

buttonHeight

Standard button height.

[Min(20)]
public float buttonHeight

Field Value

float

buttonHighlight

Hovered button.

public Color buttonHighlight

Field Value

Color

buttonPressed

Pressed button.

public Color buttonPressed

Field Value

Color

buttonSprite

9-sliced button background.

public Sprite buttonSprite

Field Value

Sprite

buttonTextPadding

Horizontal and vertical insets of button text.

public Vector2 buttonTextPadding

Field Value

Vector2

circleSprite

Round button / portrait background.

public Sprite circleSprite

Field Value

Sprite

cooldownColor

Cooldown shade over buttons.

public Color cooldownColor

Field Value

Color

damageIcon

Attack/damage icon.

public Sprite damageIcon

Field Value

Sprite

damageNumberColor

Damage number colour.

[Header("Damage numbers")]
public Color damageNumberColor

Field Value

Color

damageNumberSize

Damage number font size.

[Min(6)]
public int damageNumberSize

Field Value

int

defeatBanner

Banner shown above the result panel on defeat (replaces the title text). Empty keeps the text title.

public Sprite defeatBanner

Field Value

Sprite

dimTextColor

Secondary text.

public Color dimTextColor

Field Value

Color

experienceColor

Experience.

public Color experienceColor

Field Value

Color

fallbackFonts

Fonts tried in order for characters font lacks – for example a dynamic Korean, Japanese or Chinese font asset – after the font's own fallbacks and before the TMP Settings fallbacks. They are applied to a runtime copy of a static HUD font (such as the TMP default LiberationSans SDF), so neither that font asset nor the TMP Settings change. A dynamic HUD font ignores this list (one warning): give that font asset its own Fallback Font Assets instead.

[Tooltip("Fonts tried in order for characters the HUD font lacks (for example a dynamic CJK font asset). Applied to a runtime copy of a static HUD font; the font asset and the TMP Settings stay unchanged.")]
public List<TMP_FontAsset> fallbackFonts

Field Value

List<TMP_FontAsset>

font

TextMesh Pro font asset of the HUD, damage numbers and sample menus; empty uses the default font asset of the project's TMP Settings (LiberationSans SDF after importing the TMP Essential Resources). For Chinese, Japanese or Korean add a dynamic CJK font asset to fallbackFonts (see Documentation/Presentation.md).

[Header("Text")]
[Tooltip("TextMesh Pro font asset. Empty = the default font asset from TMP Settings. Add CJK fonts to Fallback Fonts for Korean, Japanese or Chinese tables.")]
public TMP_FontAsset font

Field Value

TMP_FontAsset

fontMaterial

Optional material preset of font (outline, glow ...); empty uses the font's material (with a drop shadow when textShadow is on).

[Tooltip("Optional material preset for the font. Empty = the font's own material, with a generated drop shadow when Text Shadow is on.")]
public Material fontMaterial

Field Value

Material

fontSize

Body text.

[Min(6)]
public int fontSize

Field Value

int

ghostAlpha

Opacity of the placement ghost.

[Range(0, 1)]
public float ghostAlpha

Field Value

float

goldColor

Gold values.

public Color goldColor

Field Value

Color

goldIcon

Gold icon.

public Sprite goldIcon

Field Value

Sprite

healNumberColor

Heal number colour.

public Color healNumberColor

Field Value

Color

healthColor

Full health.

public Color healthColor

Field Value

Color

healthLowColor

Low health.

public Color healthLowColor

Field Value

Color

heroColor

Hero selection and move markers.

public Color heroColor

Field Value

Color

iconOverrides

Icons by key (spell id, template id) that replace generated icons in the HUD.

public List<HudTheme.IconOverride> iconOverrides

Field Value

List<HudTheme.IconOverride>

incomingIcon

Wave entrance (incoming enemies) icon.

public Sprite incomingIcon

Field Value

Sprite

insetColor

Background of inset strips (target priority row, value wells) drawn inside panels.

public Color insetColor

Field Value

Color

invalidColor

Invalid target point.

public Color invalidColor

Field Value

Color

largeFontSize

Top bar values and panel titles.

[Min(6)]
public int largeFontSize

Field Value

int

livesColor

Lives values.

public Color livesColor

Field Value

Color

livesIcon

Lives icon.

public Sprite livesIcon

Field Value

Sprite

lockIcon

Locked icon.

public Sprite lockIcon

Field Value

Sprite

matchWidthOrHeight

0 = match width, 1 = match height (keeps HUD size on ultrawide screens).

[Range(0, 1)]
public float matchWidthOrHeight

Field Value

float

medallionIconInset

Inset of the icon inside a medallion, as a fraction of the button size.

[Range(0, 0.4)]
public float medallionIconInset

Field Value

float

medallionSprite

Round framed button (build menu, spells, hero portrait, wave call). Empty uses the circle / button sprites.

[Header("Painted skin (optional)")]
public Sprite medallionSprite

Field Value

Sprite

negativeColor

Unaffordable / negative values.

public Color negativeColor

Field Value

Color

outlineWidth

Outline width in world units.

[Min(0.005)]
public float outlineWidth

Field Value

float

overlayColor

Full-screen dimmer behind modal screens.

public Color overlayColor

Field Value

Color

padding

Spacing around and between elements.

[Min(0)]
public float padding

Field Value

float

panelColor

Panel tint.

[Header("Colors")]
public Color panelColor

Field Value

Color

panelPadding

Clear space between decorative panel borders and their content.

[Min(0)]
public float panelPadding

Field Value

float

panelSprite

9-sliced panel background.

[Header("Sprites (optional)")]
public Sprite panelSprite

Field Value

Sprite

pauseIcon

Pause icon.

public Sprite pauseIcon

Field Value

Sprite

playIcon

Play icon.

public Sprite playIcon

Field Value

Sprite

portraitSize

Hero portrait size.

[Min(20)]
public float portraitSize

Field Value

float

positiveColor

Affordable / positive values.

public Color positiveColor

Field Value

Color

previewColor

Range preview for builds and upgrades.

public Color previewColor

Field Value

Color

primaryButtonColor

Face of primary action buttons (Play, Continue, Done ...).

public Color primaryButtonColor

Field Value

Color

primaryTextColor

Label colour of primary action buttons.

public Color primaryTextColor

Field Value

Color

radialButtonSize

Radial build menu button size.

[Min(20)]
public float radialButtonSize

Field Value

float

radialRadius

Radial build menu radius.

[Min(20)]
public float radialRadius

Field Value

float

rallyColor

Rally radius and markers.

public Color rallyColor

Field Value

Color

rangeColor

Current range outline.

[Header("World feedback")]
public Color rangeColor

Field Value

Color

rangeFillAlpha

Fill opacity relative to the outline colour.

[Range(0, 1)]
public float rangeFillAlpha

Field Value

float

referenceResolution

Layout resolution; the canvas scales from it.

[Header("Canvas")]
public Vector2 referenceResolution

Field Value

Vector2

ribbonSprite

Price tag under build buttons (9-sliced). Empty uses the button sprite tinted with the panel colour.

public Sprite ribbonSprite

Field Value

Sprite

ringSprite

Radial progress ring.

public Sprite ringSprite

Field Value

Sprite

screenPadding

Clear space between the screen edge and fixed HUD panels.

[Min(0)]
public float screenPadding

Field Value

float

sectionColor

Section labels inside panels (ABILITIES, TARGET ...).

public Color sectionColor

Field Value

Color

selectedColor

Selected or active toggle.

public Color selectedColor

Field Value

Color

selectedTextColor

Label colour of a selected (toggled on) button; transparent keeps each label's own colour.

[Tooltip("Label colour on selected buttons (for example dark text on a gold selection). Transparent = unchanged.")]
public Color selectedTextColor

Field Value

Color

slotHoverColor

Hovered build slot.

public Color slotHoverColor

Field Value

Color

smallFontSize

Small labels (costs, hotkeys).

[Min(6)]
public int smallFontSize

Field Value

int

sortingOrder

Canvas sorting order.

public int sortingOrder

Field Value

int

spellButtonSize

Spell button size.

[Min(20)]
public float spellButtonSize

Field Value

float

starColor

Earned stars.

public Color starColor

Field Value

Color

starEmptyColor

Missing stars.

public Color starEmptyColor

Field Value

Color

starIcon

Rating star.

public Sprite starIcon

Field Value

Sprite

textColor

Main text.

public Color textColor

Field Value

Color

textShadow

Adds a drop shadow (TextMesh Pro underlay) to text.

public bool textShadow

Field Value

bool

titleFontSize

Result screen title.

[Min(6)]
public int titleFontSize

Field Value

int

tooltipColor

Tooltip plate colour (a generated rounded plate); transparent uses a darkened panelSprite.

[Tooltip("Tooltip plate colour. Transparent = the panel sprite, darkened.")]
public Color tooltipColor

Field Value

Color

topBarHeight

Top bar height.

[Header("Sizes (reference pixels)")]
[Min(24)]
public float topBarHeight

Field Value

float

towerPanelWidth

Tower panel width.

[Min(200)]
public float towerPanelWidth

Field Value

float

unitSelectColor

Selected enemy / unit ring.

public Color unitSelectColor

Field Value

Color

validColor

Valid target point.

public Color validColor

Field Value

Color

victoryBanner

Banner shown above the result panel on victory (replaces the title text). Empty keeps the text title.

public Sprite victoryBanner

Field Value

Sprite

waveColor

Wave values.

public Color waveColor

Field Value

Color

waveIcon

Wave icon.

public Sprite waveIcon

Field Value

Sprite

waveIndicatorSize

Wave entrance indicator size.

[Min(20)]
public float waveIndicatorSize

Field Value

float

Properties

BarSprite

Bar sprite.

public Sprite BarSprite { get; }

Property Value

Sprite

Button

Button sprite (with a trim, the generated face has no rim of its own: the trim draws it).

public Sprite Button { get; }

Property Value

Sprite

ButtonFrame

Button trim sprite.

public Sprite ButtonFrame { get; }

Property Value

Sprite

Circle

Circle sprite.

public Sprite Circle { get; }

Property Value

Sprite

DamageIcon

Damage icon.

public Sprite DamageIcon { get; }

Property Value

Sprite

Default

A shared in-memory theme with default values (used when none is assigned).

public static HudTheme Default { get; }

Property Value

HudTheme

Gold

Gold icon.

public Sprite Gold { get; }

Property Value

Sprite

HasButtonFrame

Whether rectangular buttons get the buttonFrameColor trim.

public bool HasButtonFrame { get; }

Property Value

bool

HasMedallion

Whether round buttons use a painted medallion frame.

public bool HasMedallion { get; }

Property Value

bool

HasTooltipPlate

Whether tooltips use their own plate (tooltipColor) instead of a darkened panel.

public bool HasTooltipPlate { get; }

Property Value

bool

Incoming

Incoming icon.

public Sprite Incoming { get; }

Property Value

Sprite

Inset

Inset strip sprite (segmented controls, value wells).

public Sprite Inset { get; }

Property Value

Sprite

Lives

Lives icon.

public Sprite Lives { get; }

Property Value

Sprite

LockIcon

Lock icon.

public Sprite LockIcon { get; }

Property Value

Sprite

Medallion

Round button background: the medallion, or the plain circle.

public Sprite Medallion { get; }

Property Value

Sprite

Panel

Panel sprite.

public Sprite Panel { get; }

Property Value

Sprite

PauseIcon

Pause icon.

public Sprite PauseIcon { get; }

Property Value

Sprite

PlayIcon

Play icon.

public Sprite PlayIcon { get; }

Property Value

Sprite

PriceTag

Price tag background.

public Sprite PriceTag { get; }

Property Value

Sprite

PriceTagColor

Price tag tint (white for a painted ribbon).

public Color PriceTagColor { get; }

Property Value

Color

RingSprite

Ring sprite.

public Sprite RingSprite { get; }

Property Value

Sprite

SpellButton

Spell button background: the medallion, or the rounded button.

public Sprite SpellButton { get; }

Property Value

Sprite

Star

Star icon.

public Sprite Star { get; }

Property Value

Sprite

TooltipColor

Tooltip background tint.

public Color TooltipColor { get; }

Property Value

Color

TooltipSprite

Tooltip background sprite.

public Sprite TooltipSprite { get; }

Property Value

Sprite

Wave

Wave icon.

public Sprite Wave { get; }

Property Value

Sprite

Methods

ResolveFont()

The configured font, or the default font asset of the TMP Settings; null when neither exists (TMP Essential Resources not imported: text objects are created but cannot render until they are). With fallbackFonts on a static font this is a cached runtime copy of that font whose fallback list ends with them.

public TMP_FontAsset ResolveFont()

Returns

TMP_FontAsset

TryGetIcon(string, out Sprite)

Finds an icon override by key.

public bool TryGetIcon(string key, out Sprite icon)

Parameters

key string
icon Sprite

Returns

bool