KSP API
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties
Public Types | Public Member Functions | Public Attributes | List of all members
KSPAddon Class Reference

Apply this attribute to a class that derives from MonoBehaviour to have KSP automatically start up your addon at a specified time. More...

Inheritance diagram for KSPAddon:

Public Types

enum  Startup {
  Startup.EditorAny = -3, Startup.Instantly = -2, Startup.EveryScene = -1, Startup.MainMenu = 2,
  Startup.Settings = 3, Startup.Credits = 4, Startup.SpaceCentre = 5, Startup.EditorVAB = 6,
  Startup.Flight = 7, Startup.TrackingStation = 8, Startup.EditorSPH = 9, Startup.PSystemSpawn = 10
}
 Possible values for when your addon can be started up. More...
 

Public Member Functions

 KSPAddon (KSPAddon.Startup startup, bool once)
 Constructor. More...
 

Public Attributes

bool once
 Whether KSP should start up your addon just once per game session, or every time the startup time is reached. If you want your addon to persist forever, even through scene changes, after being started once, set once to true. call DontDestroyOnLoad(this) in your Start() function. More...
 
KSPAddon.Startup startup
 When this addon should be started. More...
 

Detailed Description

Apply this attribute to a class that derives from MonoBehaviour to have KSP automatically start up your addon at a specified time.

At the time specified by the "startup" argument KSP will create a new GameObject and attach your MonoBehaviour to it. You can then implement the Unity event functions like Start(), Update(), etc.

Member Enumeration Documentation

Possible values for when your addon can be started up.

Enumerator
EditorAny 

Presumably, start on entering either the VAB or the SPH.

Instantly 

Presumably, start soon as possible after loading your assembly?

EveryScene 

Start up on any scene transition?

MainMenu 

Start on entering the main KSP menu.

Settings 

Start on entering the KSP settings menu.

Credits 

Start on entering the KSP credits scene.

SpaceCentre 

Start on entering the space centre scene.

EditorVAB 

Start on entering the VAB scene.

Flight 

Start on entering the flight scene.

TrackingStation 

Start on entering the tracking station scene.

EditorSPH 

Start on entering the SPH scene.

PSystemSpawn 

Start just before KSP creates the solar system? This seems to be the right hook to use for addons that modify the solar system. See the PSystemManager class and related classes.

Constructor & Destructor Documentation

KSPAddon.KSPAddon ( KSPAddon.Startup  startup,
bool  once 
)

Constructor.

Parameters
startupWhen this addon should be started
onceWhether KSP should start up your addon just once per game session, or every time the startup time is reached. If you want your addon to persist forever, even through scene changes, after being started once, set once to true. call DontDestroyOnLoad(this) in your Start() function.

Member Data Documentation

bool KSPAddon.once

Whether KSP should start up your addon just once per game session, or every time the startup time is reached. If you want your addon to persist forever, even through scene changes, after being started once, set once to true. call DontDestroyOnLoad(this) in your Start() function.

KSPAddon.Startup KSPAddon.startup

When this addon should be started.


The documentation for this class was generated from the following file: