Class Network
- Namespace
- AO
- Assembly
- CoreAssembly.dll
Network is a core engine system to with the cross platform networking API.
public class Network
- Inheritance
-
Network
- Inherited Members
- Extension Methods
Properties
IsClient
Are we the client?
public static bool IsClient { get; }
Property Value
IsServer
Are we the server?
public static bool IsServer { get; }
Property Value
LocalPlayer
Local player for this client. Null if we are the server, or if the player has not been spawned yet.
public static Player LocalPlayer { get; }
Property Value
NetSyncDataFrameNumber
[Obsolete("Use Entity member NetSyncDataFrameNumber instead.")]
public static long NetSyncDataFrameNumber { get; }
Property Value
NetSyncReceiveFrameNumber
[Obsolete("Use Entity member NetSyncReceiveFrameNumber instead.")]
public static long NetSyncReceiveFrameNumber { get; }
Property Value
Methods
ClientRpc(byte[])
[Obsolete("ClientRpc(byte[]) is deprecated. Please recompile your project and regenerate RPC source!", false)]
public static void ClientRpc(byte[] data)
Parameters
data
byte[]
ClientRpc(byte[], RPCOptions)
public static void ClientRpc(byte[] data, RPCOptions options = default)
Parameters
data
byte[]options
RPCOptions
Despawn(Entity)
Despawn an entity on the network. Must be called from the server.
public static void Despawn(Entity entity)
Parameters
entity
EntityEntity to despawn
GetRemoteCallContextPlayer()
During a ServerRpc this will return the player whose client invoked the RPC, if they are still connected. Returns null in all other cases.
public static extern Player GetRemoteCallContextPlayer()
Returns
InstantiateAndSpawn(Prefab, Action<Entity>)
public static Entity InstantiateAndSpawn(Prefab prefab, Action<Entity> onBeforeAwake = null)
Parameters
Returns
LogRPCDispatch(string)
Internal method used by generated code. Not to be called directly.
public static extern void LogRPCDispatch(string rpcName)
Parameters
rpcName
string
LogRPCInvocation(string)
Internal method used by generated code. Not to be called directly.
public static extern void LogRPCInvocation(string rpcName)
Parameters
rpcName
string
QueueAddPlayer(string, Player)
public static void QueueAddPlayer(string queue, Player player)
Parameters
QueueRemovePlayer(string, Player)
public static void QueueRemovePlayer(string queue, Player player)
Parameters
QueueSetServerAvailable(string, bool)
public static void QueueSetServerAvailable(string queue, bool available)
Parameters
ServerKickPlayer(Player, string)
Initiate a graceful kick of a player. They will not be destroyed immediately but should be after at most 5 seconds.
public static void ServerKickPlayer(Player player, string reason = "Kicked.")
Parameters
ServerPrivateInstanceHostId()
Return the host Id of this server, if it's private. Calling from client will throw an exception.
public static string ServerPrivateInstanceHostId()
Returns
- string
[PlayerId] / null (if server is not private)
ServerRpc(byte[])
[Obsolete("ServerRpc(byte[]) is deprecated. Please recompile your project and regenerate RPC source!", false)]
public static void ServerRpc(byte[] data)
Parameters
data
byte[]
ServerRpc(byte[], RPCOptions)
public static void ServerRpc(byte[] data, RPCOptions options = default)
Parameters
data
byte[]options
RPCOptions
Spawn(Entity)
Spawn an entity on the network. Must be called from the server.
public static void Spawn(Entity entity)
Parameters
entity
EntityEntity to spawn
Examples
var entity = new Entity();
// Add components, set some data
Network.Spawn(entity);