gum-runtime-variable-references

Re-evaluates Gum variable references at runtime for dynamic UI theming and styling.

614|78|Updated Mar 11, 2015
One-click install
npx skills add https://github.com/vchelaru/Gum --skill gum-runtime-variable-references
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gum-runtime-variable-references
Source: https://github.com/vchelaru/Gum/tree/main/.claude/skills/gum-runtime-variable-references
Command: npx skills add https://github.com/vchelaru/Gum --skill gum-runtime-variable-references

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Variable references authored in the Gum tool are normally baked in at design time, so changing centralized style values at runtime has no effect on existing UI. This Skill explains how to re-apply those references in code so themes and shared style values propagate across all elements after the game is running.

Core Features & Use Cases

  • ApplyAllVariableReferences: Extension method on GumProjectSave that iterates all standards, components, and screens, applying variable references on every state with topological ordering and graceful circular-dependency handling.
  • GumExpressionService: Optional Gum.Expressions NuGet package that adds Roslyn-based evaluation of arithmetic, conditional, comparison, and logical expressions in references; without it only simple dot-path lookups work.
  • Two Apply Overloads: ApplyVariableReferences can write hard values into a StateSave before UI creation, or set properties directly on live GraphicalUiElement visuals, followed by RefreshStyles to push updates.
  • Use Case: Switch your game's theme at runtime by modifying centralized style variables, calling ApplyAllVariableReferences, then RefreshStyles so every control updates without recreating the UI.

Quick Start

Ask the AI to show how to apply all Gum variable references at runtime and refresh styles after changing a theme color in code.

Frequently Asked Questions about gum-runtime-variable-references

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I apply Gum variable references at runtime?

Call the ApplyAllVariableReferences extension method on your GumProjectSave, which iterates all standards, components, and screens and applies references on every state. Afterwards call GraphicalUiElement.RefreshStyles or GumService.Default.RefreshStyles to push values to live visuals.

What is the Gum.Expressions NuGet package used for?

Gum.Expressions adds Roslyn-based expression evaluation so variable references can contain arithmetic like Width + 10, ternary conditionals, and comparison or logical operators. Without it, only simple dot-path lookups such as OtherInstance.Width are resolved.

Does Gum runtime variable reference evaluation require Roslyn?

No. The core ApplyAllVariableReferences logic lives in GumRuntime/GumCommon with no Roslyn dependency and works on all platforms. Roslyn is only needed if you opt into full expression evaluation via GumExpressionService.Initialize.

Why are my Gum variable references not updating after a language switch?

The CurrentLanguage identifier does not trigger re-evaluation on its own. After changing Localization.CurrentLanguage you must explicitly call ApplyAllVariableReferences followed by RefreshStyles, the same as any other reference update.

How does Gum handle circular dependencies in variable references?

ApplyAllVariableReferences uses a topological sort so referenced values are applied before their dependents. Circular dependencies are handled gracefully by appending them at the end rather than failing or looping infinitely.