D
D
DOTSNET
Search…
NetworkClientSystem
NetworkClientSystem is the main client class, found in ClientWorld.
NetworkClientSystemAuthoring can be used to interact with it from the Inspector. In the example scene, the NetworkClient scene object has the authoring component:

NetworkClientSystem API

Property:
Description:
state
Current client state (disconnected/connecting/connected).
disconnectedFreezesScene
Convenience feature that decides what to do after the client disconnects. By default, all NetworkEntities will be destroyed and cleaned up immediately.
Enable this flag to freeze them in the scene instead, which is what some MMOs do because it looks cool.
The NetworkEntities will automatically be cleaned up in the next Connect() call again.
spawned
All spawned Entities by netId that are around the player. Unlike the server, those aren’t all entities that were spawned in the world. Only the player’s observers.
Function:
Description:
Connect(address)
Connect to a server listening on the specified address. This is not blocking, it will simply start the connect process, set the state to CONNECTING and then to CONNECTED a bit later.
Disconnect()
Disconnect from the server. This happens immediately and the state is set to DISCONNECTED.
Send(message, channel)
Send a NetworkMessage to the server.
Some transports support different channels.
If in doubt, leave the channel at default = Reliable.
OnConnected()
Virtual function for classes that inherit from NetworkClientSystem.
OnDisconnected()
Virtual function for classes that inherit from NetworkClientSystem.
RegisterHandler<T>(handler)
Register a handler for an incoming message. Inheriting from NetworkClientMessageSystem registers it automatically.
NOTE: custom allocator for the new NetworkMessage<T> can be passed as third parameter in case a system wants to reuse large messages like WorldStateMessage instead of allocating each time.
UnregisterHandler<T>
Unregister handler for the NetworkMessage type.
Last modified 18d ago
Copy link