Mod:Creation Kit/SetMaterialSwap - ObjectReference

F4SE Member of: Mod:Creation Kit/ObjectReference Script

Sets the internal persistent Mod:Creation Kit/Material Swap for this reference.

This function does not apply a visual update, you must use ApplyMaterialSwap. This will make the game take care of setting the material swap when the game is loaded. ApplyMaterialSwap is a more greedy method of applying materials so the nif objects the game applies materials to may not match up with the ApplyMaterialSwap function. Behavior may not be as expected when applied to living references, Mod:Creation Kit/Weapons, or Mod:Creation Kit/Armor placed in the world.

Syntax
Function SetMaterialSwap(MatSwap mSwap) Native

Parameters

 * mSwap: The Mod:Creation Kit/Material Swap added to this reference.
 * Adding persistent material swaps will increase save-size by a small amount. Setting this to  will remove persistence and free up save-space.

Return Value
None

Examples
weaponReference.SetMaterialSwap(myMaterialSwap) Debug.Trace("Set the material swap to "+myMaterialSwap+" on the "+weaponReference+" reference.")