Click or drag to resize

ConfigAccessorReadPartConfig Method

Reads custom type fileds from the part's config.

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 ReadPartConfig(
	PartModule module,
	ConfigNode cfgNode
)
Request Example View Source

Parameters

module
Type: (Default Namespace)PartModule
The module to load the data for.
cfgNode
Type: (Default Namespace)ConfigNode
The config node, passed by the game to the module.
Remarks

The consumer code must call this method from the OnLoad method to capture the PartLoader initalization. This method automatically detects the game loading phase, so it's safe to call it in every OnLoad inovacation.

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