LethalNetworkAPI.LethalNetworkExtensions Class
OBSOLETE
This class is deprecated. Please use LNetworkUtils instead.
Additional tools to help with networking.
public static class LethalNetworkExtensionsInheritance
↳ System.Object
↳ LethalNetworkAPI.LethalNetworkExtensions
Methods
GetClientId(this PlayerControllerB)
Gets the ulong from a given PlayerControllerB.
Declaration
public static ulong GetClientId(this PlayerControllerB player)Parameters
| Type | Name | Description |
|---|---|---|
PlayerControllerB | player | The player controller. |
Returns
| Type | Description |
|---|---|
ulong | The player's client id. |
GetNetworkVariable<TData>(this GameObject, string, bool)
Get a NetworkVariable with the identifier specific to the NetworkObject. If one doesn't exist, it creates a new one on all clients.
Declaration
public static LethalNetworkVariable<TData>? GetNetworkVariable<TData>(this GameObject gameObject, string identifier, bool serverOwned = false)Parameters
| Type | Name | Description |
|---|---|---|
GameObject | gameObject | The GameObject to attach the variable to. Only networked objects are permitted. |
string | identifier | An identifier for the variable. Specific to the network object. |
bool | serverOwned | [Opt.] Set to true if only the server should be able to write to it. |
Type Parameters
| Type | Description |
|---|---|
TData | The serializable data type of the variable. |
Returns
| Type | Description |
|---|---|
LethalNetworkVariable<TData>? | The network variable. |
Remarks
The variable is set to only allow writing by the object's owner client. In order to sync on all clients, the host must also run this method on the same GameObject with the same identifier.
GetNetworkVariable<TData>(this NetworkBehaviour, string, bool)
Get a NetworkVariable with the identifier specific to the NetworkObject. If one doesn't exist, it creates a new one on all clients.
Declaration
public static LethalNetworkVariable<TData>? GetNetworkVariable<TData>(this NetworkBehaviour networkBehaviour, string identifier, bool serverOwned = false)Parameters
| Type | Name | Description |
|---|---|---|
NetworkBehaviour | networkBehaviour | The NetworkBehaviour to attach the variable to. |
string | identifier | An identifier for the variable. Specific to the network object. |
bool | serverOwned | [Opt.] Set to true if only the server should be able to write to it. |
Type Parameters
| Type | Description |
|---|---|
TData | The serializable data type of the variable. |
Returns
| Type | Description |
|---|---|
LethalNetworkVariable<TData>? | The network variable. |
Remarks
The variable is set to only allow writing by the object's owner client. In order to sync on all clients, the host must also run this method on the same GameObject with the same identifier.
GetNetworkVariable<TData>(this NetworkObject, string, bool)
Get a NetworkVariable with the identifier specific to the NetworkObject. If one doesn't exist, it creates a new one on all clients.
Declaration
public static LethalNetworkVariable<TData>? GetNetworkVariable<TData>(this NetworkObject networkObject, string identifier, bool serverOwned = false)Parameters
| Type | Name | Description |
|---|---|---|
NetworkObject | networkObject | The NetworkObject to attach the variable to. |
string | identifier | An identifier for the variable. Specific to the network object. |
bool | serverOwned | [Opt.] Set to true if only the server should be able to write to it. |
Type Parameters
| Type | Description |
|---|---|
TData | The serializable data type of the variable. |
Returns
| Type | Description |
|---|---|
LethalNetworkVariable<TData>? | The network variable. |
Remarks
The variable is set to only allow writing by the object's owner client. In order to sync on all clients, the host must also run this method on the same GameObject with the same identifier.
GetPlayerController(this ulong)
Gets the PlayerControllerB from a given clientId.
Declaration
public static PlayerControllerB? GetPlayerController(this ulong clientId)Parameters
| Type | Name | Description |
|---|---|---|
ulong | clientId | The client id. |
Returns
| Type | Description |
|---|---|
PlayerControllerB? | The player controller component. |
Remarks
Will return null if the controller is not found.