# MaterialSwapper

`MaterialSwapper` replaces renderer material properties on matching named materials in the active part hierarchy.

## Purpose

Use this transformer when a variant should change a part's visual finish without changing the underlying mesh. Typical uses include paint schemes, foil vs bare-metal variants, and B9-style visual skins.

## Type

Source-backed runtime type: `VSwift.Modules.Transformers.MaterialSwapper`

## Fields

* `Swaps`: `Dictionary<string, string>`
* Each key is the source material name to match on the instantiated part
* Each value is the target material identifier to load

## Behavior

* `ApplyCommon`: recursively walks the part hierarchy, finds renderer materials whose names match the source key, and copies properties from the loaded target material
* `ApplyInOab`: no effect
* `ApplyInFlight`: no effect
* After applying swaps, V-SwiFT queues a color refresh on the part-switch module

## State handling

* Reverter: yes, via `MaterialReverter.Instance`
* Saves information: no
* Visualizes information: flagged as yes by the transformer

## Example

```patch
Transformers: [
  {
    Name: "MaterialSwapper",
    Swaps: {
      "tank_body": "addressables://MyMod/Materials/TankBody_White"
    }
  }
]
```

## Caveats

* The current implementation only supports targets addressed as `addressables://...`.
* Matching is done by material name on instantiated renderers, after stripping Unity's usual clone/instance suffixes.
* The class advertises `VisualizesInformation = true`, but the source file does not currently implement a custom stat-block renderer of its own.

## Related

* [TransformActivator](https://docs.ksp2redux.org/doc/transformactivator-y7ouU3HMof)
* [Examples](https://docs.ksp2redux.org/doc/examples-3HSDNq0X2l)