Class AirshipNetworkBehaviourAbstract

A TypeScript parallel to the C# NetworkBehaviour for Airship.

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

This component REQUIRES a NetworkObject in the same game object or in the parent of the heirachy

Example declaration:

export default class ExampleBehaviour extends AirshipNetworkBehaviour {
public OnClientStart() {
print("Hello, World! from the client!");
}
public OnServerStart() {
print("Hello, World! from the server!");
}

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 AirshipNetworkBehaviour

    Deprecated

Properties

gameObject: GameObject

The GameObject this behaviour is attached to.

networkIdentity: NetworkIdentity

The NetworkObject 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

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

    Parameters

    • dt: number

    Returns void

  • Gets the player who owns this object (if applicable)

    • Will return undefined if the object is server-owned or the owner is no longer in the server
    • If you want to verify the owner isn't the server, use IsServerOwned. or if the caller is the owner IsOwned

    Returns undefined | Player

  • Returns true if the caller is the owner of this object

    Returns boolean

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

    Parameters

    • dt: number

    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

  • Like Start(), but only called for objects the client has authority over.

    Returns void

  • Like Start(), but only called on client and host.

    Returns void

  • Like Start(), but only called on server and host.

    Returns void

  • Stop event, only called for objects the client has authority over.

    Returns void

  • Stop event, only called on client and host.

    Returns void

  • Stop event, only called on server and host.

    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