Variant

This page documents one concrete variant entry inside a VariantSet.

Purpose

A Variant is one selectable option in a variant set. Its transformer list is where the authored behavior actually lives.

Source-backed type

  • C# type: VSwift.Modules.Variants.Variant

Key fields

  • VariantId: string

  • VariantLocalizationKey: string

  • Transformers: list[ITransformer]

Runtime role

  • VariantId is the internal identifier and the stored active-selection value.

  • VariantLocalizationKey supplies the display name. If it is empty, V-SwiFT falls back to VariantId.

  • Transformers is the ordered list of actions and visualizers attached to the variant.

Tech gating

A tech tree node unlocks a variant. The node names the variant in its UnlockedVariants list, by part name, variant set ID and variant ID. A variant that no node names is always selectable. If two nodes name the same variant, the first node that loads unlocks it. Parts work the same way.

Gating applies only when parts are unlocked by science. In Sandbox, or with the Unlock All Parts cheat, every variant is selectable. In the OAB, the dropdown leaves out a locked variant. The popout shows it, with the node that unlocks it. Science shows how a patch adds a variant to a node.

Example

+Hydrogen {
    VariantLocalizationKey: "MyMod/Tank/Hydrogen";

    +ResourceContainerAdder {
        Containers: [ /* container definitions */ ];
    }

    +MassModifier {
        Modifier: 0.15;
    }
}

Notes

The order of transformers inside a variant matters when V-SwiFT later stores saved-information entries, because those saved entries are indexed by transformer position.