Click or drag to resize

ConfigAccessorCopyPartConfigFromPrefab Method

Copies the custom part fields from the prefab into the instance.

Namespace:  KSPDev.ConfigUtils
Assembly:  KSPDev_Utils.1.1 (in KSPDev_Utils.1.1.dll) Version: 1.1 for KSP v1.6+
Syntax
C#
public static void CopyPartConfigFromPrefab(
	PartModule tgtModule
)
Request Example View Source

Parameters

tgtModule
Type: (Default Namespace)PartModule
The module to copy the fields into.
Remarks
The consumer code must call this method from the OnAwake method to ensure the custom fields are properly intialized.
Examples
public class ReadPartConfigExample : PartModule {
  public override void OnAwake() {
    base.OnAwake();
    // get hthe custom fields from the prefab.
    ConfigAccessor.CopyPartConfigFromPrefab(this);
  }

  public override void OnLoad(ConfigNode node) {
    base.OnLoad(node);
    // Load part's config custom fields in the scenes that clone the parts.
    ConfigAccessor.ReadPartConfig(this, node);
  }
}
See Also