Class Character

A character is a (typically human) object in the scene. It controls movement and default animation. Typically a game would spawn a character for each player. If using the default character it would be dressed with their customized outfit.

To spawn a character use Player.SpawnCharacter. To control your game's default character see CharacterConfigSetup.

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 Character

    Deprecated

Properties

bin: Bin = ...

A bin that is cleaned when the entity despawns.

gameObject: GameObject

The GameObject this behaviour is attached to.

transform: Transform

The Transform this behaviour is attached to.

Methods

  • Despawns this character.

    SERVER ONLY METHOD

    Returns void

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

    Parameters

    • dt: number

    Returns void

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

    Returns void

  • Sets a characters health to a certain value. If the health is <= 0, the character will die.

    Parameters

    • health: number

      The new health value.

    • Optional dontInflictDeath: boolean

      If true, a death event will not be fired if the character's new health is less than or equal to zero. This is useful when you want to broadcast a custom death event with Airship.Damage.BroadcastDeath.

    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

  • This should be called from the server.

    You can call it from the client only when using Client Authoratative characters.

    Parameters

    • pos: Vector3
    • Optional lookVector: Vector3

    Returns void

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

    Parameters

    • dt: number

    Returns void