NetworkClient Class
Namespace: SWNetwork
NetworkClient is the entry point of your game to interact with the SocketWeaver backend services. You must have one and only one NetworkClient active in your Scene.
It is recommended to add the NetworkClient component to a separate GameObject in your scene. NetworkClient will automatically prevent the GameObject from being destroyed between Scenes.
Declaration
Properties | Type | Description |
VERSION | string | SWNetwork SDK version. |
Lobby | Lobby instance. | |
IsHost | bool | Indicates whether the local player is the host of a game. IsHost gets set when clients connect to the room game server and is managed by the game server, the game server is always polling all connected clients. If the current host player got disconnected, the game server will select a new host. |
PlayerId | string | Local player's Id. |
LastSpawner | SceneSpawner | Last SceneSpawner. Usually, it is the SceneSpawner of the last loaded scene. |
loggingLevel | LoggingLevel | Controls the logging of the SWNetwork SDK lower level code. Error is the default setting. |
Log File Path | string | Controls log output directory |
Development Player Id | string | Overrides the playerId for development use. On the first launch of a SocketWeaver powered networked game, SWNetwork SDK generates a unique playerId and stores it in the player's device hard drive. This playerId is used in the SocketWeaver backends to identify the player. For development and testing use, you can manually assign a playerId using this field. |
API_KEY | string | The APIKEY of your game. It is generated in the SocketWeaver Developer Portal |
lobbyName | string | Preferred Lobby region name. |
nodeRegion1 | string | Preferred game server region name1. |
nodeRegion2 | string | Preferred game server region name2. |
LobbyPing | int | Network latency between the client and the lobby server in milliseconds (ms). |
GameServerPing | int | Network latency between the client and the game server in milliseconds (ms). |
Methods | Description |
DisconnectFromRoom() | Disconnects the local player from the room game servers. |
ConnectToRoom(Action<bool>) | Connects the local player to the room game servers. |
FindSpawner(UInt16) | Finds the SceneSpawner with the specified SpawnerId. |
CheckIn() | Checking into the SocketWeaver services with a random generated unique player Id. |
CheckIn(string) | Checking into the SocketWeaver services with specified player Id. Make sure the playerId is unique. |
Last updated