Click or drag to resize

IsDestroyable Interface

Interface for modules that need to know if script object is destroyed.

Namespace:  KSPDev.KSPInterfaces
Assembly:  KSPDev_Utils.2.0 (in KSPDev_Utils.2.0.dll) Version: 2.0 for KSP v1.8+
Syntax
C#
public interface IsDestroyable
Request Example View Source

The IsDestroyable type exposes the following members.

Methods
  NameDescription
Public methodOnDestroy
Triggers when Unity object is about to destroy.
Top
Remarks
Events of this inteface are triggered by Unity engine via reflections. It's not required for the module to implement the interface to be notified but by implementing it the code becomes more consistent and less error prone.
Examples
public class MyModule : PartModule, IsDestroyable {
  /// <inheritdoc/>
  public void OnDestory() {
    Debug.LogInfo("OnDestory");
  }
}
See Also