NetworkPlayer

Immutable record that associates a NetworkUser (identity) with a NetworkClient (Netcode connection). Provides a unified view of a connected player's identity, client ID, and player object.

Definition

Namespace: Paragon.Core.Network Assembly: Paragon.dll

public record NetworkPlayer

Remarks

NetworkPlayer bridges the gap between the authentication/identity layer (NetworkUser — user ID and display name) and the Netcode transport layer (NetworkClient — client ID and player object). It is used by the NetworkSession to track connected players.

As a C# record, it provides:

  • Value equality based on field values

  • Immutability — fields are readonly and set only via the constructor

  • Built-in ToString() — returns "User: [UserID] UserName, Client: ClientID"

Quick Lookup

Goal
How

Get user identity

player.User or player.UserID / player.UserName

Get Netcode client ID

player.ClientID

Get the player's NetworkObject

player.PlayerObject

Get the underlying NetworkClient

player.Client

Properties

User

The NetworkUser record representing the player's authenticated identity.

Client

The Netcode NetworkClient representing the player's connection.

UserID

The player's unique user identifier. Shortcut to User.ID.

UserName

The player's display name. Shortcut to User.Name.

ClientID

The player's Netcode client ID. Shortcut to Client.ClientId.

PlayerObject

The NetworkObject associated with this player's connection (the player's owned network object).

Methods

Constructor

Parameter
Type
Description

user

NetworkUser

The authenticated user identity

client

NetworkClient

The Netcode client connection

ToString

Returns a formatted string with user and client info.

Returns: "User: [UserID] UserName, Client: ClientID"

Examples

Creating a NetworkPlayer

Iterating Session Players

See Also

Last updated