Class NetworkClient
NetworkClient with connection to server.
Inheritance
NetworkClient
Assembly: doc.dll
Syntax
public static class NetworkClient : object
Fields
|
Improve this Doc
View Source
aoi
Declaration
public static InterestManagement aoi
Field Value
|
Improve this Doc
View Source
isLoadingScene
Declaration
public static bool isLoadingScene
Field Value
|
Improve this Doc
View Source
OnConnectedEvent
Declaration
public static Action OnConnectedEvent
Field Value
|
Improve this Doc
View Source
OnDisconnectedEvent
Declaration
public static Action OnDisconnectedEvent
Field Value
|
Improve this Doc
View Source
OnErrorEvent
Declaration
public static Action<TransportError, string> OnErrorEvent
Field Value
|
Improve this Doc
View Source
prefabs
Registered spawnable prefabs by assetId.
Declaration
public static readonly Dictionary<Guid, GameObject> prefabs
Field Value
Type |
Description |
Dictionary<Guid, GameObject> |
|
|
Improve this Doc
View Source
ready
True if client is ready (= joined world).
Declaration
Field Value
|
Improve this Doc
View Source
spawned
All spawned NetworkIdentities by netId.
Declaration
public static readonly Dictionary<uint, NetworkIdentity> spawned
Field Value
Properties
|
Improve this Doc
View Source
active
active is true while a client is connecting/connected
Declaration
public static bool active { get; }
Property Value
|
Improve this Doc
View Source
connection
Client's NetworkConnection to server.
Declaration
public static NetworkConnection connection { get; }
Property Value
|
Improve this Doc
View Source
isConnected
Check if client is connected (after connecting).
Declaration
public static bool isConnected { get; }
Property Value
|
Improve this Doc
View Source
isConnecting
Check if client is connecting (before connected).
Declaration
public static bool isConnecting { get; }
Property Value
|
Improve this Doc
View Source
isHostClient
True if client is running in host mode.
Declaration
public static bool isHostClient { get; }
Property Value
|
Improve this Doc
View Source
localPlayer
NetworkIdentity of the localPlayer
Declaration
public static NetworkIdentity localPlayer { get; }
Property Value
|
Improve this Doc
View Source
serverIp
IP address of the connection to server.
Declaration
public static string serverIp { get; }
Property Value
Methods
|
Improve this Doc
View Source
AddPlayer()
Sends AddPlayer message to the server, indicating that we want to join the world.
Declaration
public static bool AddPlayer()
Returns
|
Improve this Doc
View Source
ClearSpawners()
This clears the registered spawn prefabs and spawn handler functions for this client.
Declaration
public static void ClearSpawners()
|
Improve this Doc
View Source
Connect(String)
Connect client to a NetworkServer by address.
Declaration
public static void Connect(string address)
Parameters
Type |
Name |
Description |
String |
address |
|
|
Improve this Doc
View Source
Connect(Uri)
Connect client to a NetworkServer by Uri.
Declaration
public static void Connect(Uri uri)
Parameters
Type |
Name |
Description |
Uri |
uri |
|
|
Improve this Doc
View Source
ConnectHost()
Declaration
public static void ConnectHost()
|
Improve this Doc
View Source
ConnectLocalServer()
Declaration
public static void ConnectLocalServer()
|
Improve this Doc
View Source
DestroyAllClientObjects()
Destroys all networked objects on the client.
Declaration
public static void DestroyAllClientObjects()
|
Improve this Doc
View Source
Disconnect()
Declaration
public static void Disconnect()
|
Improve this Doc
View Source
GetPrefab(Guid, out GameObject)
Find the registered prefab for this asset id.
Declaration
public static bool GetPrefab(Guid assetId, out GameObject prefab)
Parameters
Type |
Name |
Description |
Guid |
assetId |
|
GameObject |
prefab |
|
Returns
|
Improve this Doc
View Source
PrepareToSpawnSceneObjects()
Call this after loading/unloading a scene in the client after connection to register the spawnable objects
Declaration
public static void PrepareToSpawnSceneObjects()
|
Improve this Doc
View Source
Ready()
Sends Ready message to server, indicating that we loaded the scene, ready to enter the game.
Declaration
public static bool Ready()
Returns
|
Improve this Doc
View Source
RegisterHandler<T>(Action<T>, Boolean)
Register a handler for a message type T. Most should require authentication.
Declaration
public static void RegisterHandler<T>(Action<T> handler, bool requireAuthentication = true)
where T : struct, NetworkMessage
Parameters
Type |
Name |
Description |
Action<T> |
handler |
|
Boolean |
requireAuthentication |
|
Type Parameters
|
Improve this Doc
View Source
RegisterPrefab(GameObject)
Register spawnable prefab.
Declaration
public static void RegisterPrefab(GameObject prefab)
Parameters
Type |
Name |
Description |
GameObject |
prefab |
|
|
Improve this Doc
View Source
RegisterPrefab(GameObject, Guid)
Register spawnable prefab with custom assetId.
Declaration
public static void RegisterPrefab(GameObject prefab, Guid newAssetId)
Parameters
Type |
Name |
Description |
GameObject |
prefab |
|
Guid |
newAssetId |
|
|
Improve this Doc
View Source
RegisterPrefab(GameObject, Guid, SpawnDelegate, UnSpawnDelegate)
Register a spawnable prefab with custom assetId and custom spawn/unspawn handlers.
Declaration
public static void RegisterPrefab(GameObject prefab, Guid newAssetId, SpawnDelegate spawnHandler, UnSpawnDelegate unspawnHandler)
Parameters
|
Improve this Doc
View Source
RegisterPrefab(GameObject, Guid, SpawnHandlerDelegate, UnSpawnDelegate)
Register a spawnable prefab with custom assetId and custom spawn/unspawn handlers.
Declaration
public static void RegisterPrefab(GameObject prefab, Guid newAssetId, SpawnHandlerDelegate spawnHandler, UnSpawnDelegate unspawnHandler)
Parameters
|
Improve this Doc
View Source
RegisterPrefab(GameObject, SpawnDelegate, UnSpawnDelegate)
Register a spawnable prefab with custom spawn/unspawn handlers.
Declaration
public static void RegisterPrefab(GameObject prefab, SpawnDelegate spawnHandler, UnSpawnDelegate unspawnHandler)
Parameters
|
Improve this Doc
View Source
RegisterPrefab(GameObject, SpawnHandlerDelegate, UnSpawnDelegate)
Register a spawnable prefab with custom spawn/unspawn handlers.
Declaration
public static void RegisterPrefab(GameObject prefab, SpawnHandlerDelegate spawnHandler, UnSpawnDelegate unspawnHandler)
Parameters
|
Improve this Doc
View Source
RegisterSpawnHandler(Guid, SpawnDelegate, UnSpawnDelegate)
This is an advanced spawning function that registers a custom assetId with the spawning system.
Declaration
public static void RegisterSpawnHandler(Guid assetId, SpawnDelegate spawnHandler, UnSpawnDelegate unspawnHandler)
Parameters
|
Improve this Doc
View Source
RegisterSpawnHandler(Guid, SpawnHandlerDelegate, UnSpawnDelegate)
This is an advanced spawning function that registers a custom assetId with the spawning system.
Declaration
public static void RegisterSpawnHandler(Guid assetId, SpawnHandlerDelegate spawnHandler, UnSpawnDelegate unspawnHandler)
Parameters
|
Improve this Doc
View Source
ReplaceHandler<T>(Action<T>, Boolean)
Replace a handler for a particular message type. Should require authentication by default.
Declaration
public static void ReplaceHandler<T>(Action<T> handler, bool requireAuthentication = true)
where T : struct, NetworkMessage
Parameters
Type |
Name |
Description |
Action<T> |
handler |
|
Boolean |
requireAuthentication |
|
Type Parameters
|
Improve this Doc
View Source
ReplaceHandler<T>(Action<NetworkConnection, T>, Boolean)
Replace a handler for a particular message type. Should require authentication by default.
Declaration
public static void ReplaceHandler<T>(Action<NetworkConnection, T> handler, bool requireAuthentication = true)
where T : struct, NetworkMessage
Parameters
Type Parameters
|
Improve this Doc
View Source
Send<T>(T, Int32)
Send a NetworkMessage to the server over the given channel.
Declaration
public static void Send<T>(T message, int channelId = null)
where T : struct, NetworkMessage
Parameters
Type |
Name |
Description |
T |
message |
|
Int32 |
channelId |
|
Type Parameters
|
Improve this Doc
View Source
Shutdown()
Declaration
public static void Shutdown()
|
Improve this Doc
View Source
UnregisterHandler<T>()
Unregister a message handler of type T.
Declaration
public static bool UnregisterHandler<T>()
where T : struct, NetworkMessage
Returns
Type Parameters
|
Improve this Doc
View Source
UnregisterPrefab(GameObject)
Removes a registered spawn prefab that was setup with NetworkClient.RegisterPrefab.
Declaration
public static void UnregisterPrefab(GameObject prefab)
Parameters
Type |
Name |
Description |
GameObject |
prefab |
|
|
Improve this Doc
View Source
UnregisterSpawnHandler(Guid)
Removes a registered spawn handler function that was registered with NetworkClient.RegisterHandler().
Declaration
public static void UnregisterSpawnHandler(Guid assetId)
Parameters
Type |
Name |
Description |
Guid |
assetId |
|