Class AirshipSingletonAbstract

A TypeScript parallel to a component Singleton for Airship - no boilerplate required

  • To expose the serializable properties to the inspector, it must be exported as default.

Example declaration:

export default class ExampleSingleton extends AirshipSingleton {
public PrintHelloWorld() {
print("Hello, World!");
}
}

The singleton can then be retrieved via

import ExampleSingleton from "./ExampleSingleton";
export default class SomeRequiringComponent extends AirshipBehaviour {
public Start() {
const exampleSingleton = ExampleSingleton.Get();
exampleSingleton.PrintHelloWorld();
}
}

Hierarchy (view full)

Constructors

  • Use Awake instead of overloading the constructor!

    • You can specify non-optional properties using the null-assertion operator - !
    export default class ExampleBehaviour extends AirshipBehaviour {
    textComponent!: TMP_Text;
    Awake() {
    this.textComponent = this.gameObject.GetComponent<TMP_Text>();
    }
    }

    Returns AirshipSingleton

    Deprecated

Properties

gameObject: GameObject

The GameObject this behaviour is attached to.

transform: Transform

The Transform this behaviour is attached to.

Accessors

  • get enabled(): boolean
  • The enabled state of this component

    Returns boolean

Methods

  • Awake is called when an enabled script instance is being loaded.

    Returns void

  • Frame-rate independent AirshipBehaviour.FixedUpdate message for physics calculations.

    Parameters

    • dt: number

    Returns void

  • Resolves a single instance of this Singleton object statically

    Type Parameters

    • TThis

    Parameters

    Returns TThis["prototype"]

  • LateUpdate is called every frame, if the AirshipBehaviour is enabled.

    Parameters

    • dt: number

    Returns void

  • Destroying the attached Behaviour will result in the game or Scene receiving OnDestroy.

    Returns void

  • This function is called when the behaviour becomes disabled.

    Returns void

  • This function is called when the object becomes enabled and active.

    Returns void

  • OnStart is called on the frame when a script is enabled just before any of the Update methods are called the first time.

    Returns void

  • Update is called every frame, if the AirshipBehaviour is enabled.

    Parameters

    • dt: number

    Returns void