Click or drag to resize

ILinkSourcelinkTarget Property

Target of the link.

Namespace:  KASAPIv2
Assembly:  KAS-API-v2 (in KAS-API-v2.dll) Version: KAS API v2
Syntax
C#
ILinkTarget linkTarget { get; }
Request Example View Source

Property Value

Type: ILinkTarget
Target or null if nothing is linked.
Remarks
It only defined for an established link.
Examples
// Returns the linked part of the source, if any. It assumes there is exactly one source module
// on the source part.
public static Part FindTargetFromSource(Part srcPart) {
  var source = srcPart.FindModulesImplementing<ILinkSource>()
      .FirstOrDefault(s => s.linkTarget != null);
  if (source == null) {
    Debug.Log("Source is not connected");
    return null;
  }
  return source.linkTarget.part;
}
See Also