Class Player

The player object represents a client connected to your Airship game server (or a bot player if spawned).

Properties

character: undefined | Character

The player controls this entity.

connectionId: number

Unique network connection ID for the player in the given server. This ID is typically given to network requests as a way to identify the player to/from the server.

This is not a unique identifier for the player outside of the server and will not persist. For a completely unique ID, use userId.

onCharacterChanged: Signal<undefined | Character> = ...

Fired when the player's character changes.

onLeave: Signal<void> = ...

Fired when the player disconnects from the server. Connections will automatically be disconnected when the player leaves.

platform: AirshipPlatform = ...

WARNING: not implemented yet. only returns local platform for now.

profileImageId: string

Image id used to fetch player's profile picture.

userId: string

The player's unique ID. This is unique and unchanging per player.

String length is <= 128 characters (but will likely be far shorter -- typically 28 characters).

username: string

The player's username. This should be used for display. Username can change, so to save a player's data use userId.

voiceChatAudioSource: AudioSource

Audio source for player's voice chat. Attached to a Game Object that can be reparented to control voice chat position. By default this lives under the player's character and is muted for the local player.

Methods

  • Returns NetworkConnection

    The network connection associated with this player.

  • IsConnected will return true until a player disconnects from the server.

    Returns boolean

  • Sends player a message in chat. If called from client this won't work on non-local players.

    Parameters

    • message: string

      Message to send in chat.

    Returns void

  • Can yield if the player's outfit hasn't finished downloading.

    Parameters

    • position: Vector3
    • Optional config: {
          customCharacterTemplate?: GameObject;
          lookDirection?: Vector3;
      }
      • Optional customCharacterTemplate?: GameObject
      • Optional lookDirection?: Vector3

    Returns Character