VariantsUtilsExecuteAtPartVariant Method |
Executes an action on a part with an arbitrary variant applied.
Namespace:
KSPDev.PartUtils
Assembly:
KSPDev_Utils.1.1 (in KSPDev_Utils.1.1.dll) Version: 1.1 for KSP v1.6+
Syntaxpublic static void ExecuteAtPartVariant(
AvailablePart avPart,
PartVariant variant,
Action<Part> fn
)
Request Example
View SourceParameters
- avPart
- Type: (Default Namespace)AvailablePart
The part proto. - variant
- Type: (Default Namespace)PartVariant
The variant to apply. Set it to null to use the default part variant.
- fn
- Type: SystemActionPart
The action to call once the variant is applied. The argument is a prefab part with the variant
applied, so changing it or obtaining any hard references won't be a good idea. The prefab
part's variant will be reverted before the method return.
Remarks
If the part doesn't support variants, then the action is executed for the unchanged prefab.
See Also