Mirror/docs/Events/Server.md

22 lines
1.5 KiB
Markdown
Raw Normal View History

# Server Events Overview
General description of Server Events
- **OnServerConnect**
2019-01-28 20:01:07 +00:00
Called on the server when a new client connects.
2019-01-01 01:27:46 +00:00
Miror calls this on the Server when a Client connects to the Server. Use an override to tell the NetworkManager what to do when a client connects to the server.
- **OnServerDisconnect**
2019-01-28 20:01:07 +00:00
Called on the server when a client disconnects.
2019-01-01 01:27:46 +00:00
This is called on the Server when a Client disconnects from the Server. Use an override to decide what should happen when a disconnection is detected.
- **OnServerAddPlayer**
2019-01-28 20:01:07 +00:00
Called on the server when a client adds a new player with ClientScene.AddPlayer.
2019-01-01 01:27:46 +00:00
The default implementation for this function creates a new player object from the playerPrefab.
- **OnServerRemovePlayer**
2019-01-28 20:01:07 +00:00
Called on the server when a client removes a player.
The default implementation of this function destroys the corresponding player object.
__Note__: OnServerRemovePlayer is only called if a RemovePlayer message is received, and a RemovePlayer message is only sent if ClientScene.RemovePlayer() is called. ClientScene.RemovePlayer() is never called by Mirror code. You must call it yourself to receive OnServerRemovePlayer in your NetworkManager.
- **OnServerSceneChanged**
2019-01-01 01:27:46 +00:00
Called on the server when a Scene is completed loaded, when the Scene load was initiated by the server with ServerChangeScene().
- **OnServerError**
2019-01-01 01:27:46 +00:00
Called on the server when a network error occurs for a client connection.