mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 19:10:32 +00:00
76b75dbb9b
* Documentation Outline * Spacing adjustments * Captured old wiki content * yml fix * Docs work * resize images * Replaced images * Removed md from links * Renamed Misty to Fizzy * Captured Unity docs * links cleanup * clear links * Cleanup and moved NetworkBehavior to Classes. * added slashes to yml paths * reverted slashes * Fixes bad link * Update Ignorance.md This should be enough documentation for now, yeah? * Localized images * Update Ignorance.md formatting updates * Lots of Cleanup * fix link * Formatting * fix code blocks * Lots of content and cleanup * fixed yml * Added blank line * Added spaces in titles * tightened bullets * Fixed bullet spacing * Fixed more bullets * unbolded content * Cleanup and removal of empty pages Updated README with links to docs pages * Restored prior version * Contributing * Improvements to content * lower case fix * fix link * renamed Contributions * fixed link * home page content * Fixed Encoding * Moved Why TCP * Replaced Unity with Mirror * Telepathy Description * changed to h2 * Moved Sample down * Removed dead links * Copied Contributions Added Test Fixed h3's * Fixed headings * added to Test * Fixed image alts and links * fixed last alt
41 lines
1.6 KiB
Markdown
41 lines
1.6 KiB
Markdown
# NetworkBehaviour Callbacks
|
|
|
|
Like the Network Manager callbacks, there are a number of events relating to network behaviours that can occur over the course of a normal multiplayer game. These include events such as the host starting up, a player joining, or a player leaving. Each of these possible events has an associated **callback** that you can implement in your own code to take action when the event occurs.
|
|
|
|
When you create a script which **inherits** from NetworkBehaviour, you can write your own implementation of what should happen when these events occur. To do this, you override the virtual methods on the `NetworkBehaviour` class with your own implementation of what should happen when the given event occurs.
|
|
|
|
This page lists all the virtual methods (the callbacks) that you can implement on Network Behaviour, and when they occur. A game can run in one of three modes, **host**, **client**, or **server-only**. The callbacks for each mode are listed below:
|
|
|
|
## Callbacks in server mode
|
|
|
|
**When a client connects:**
|
|
|
|
- `OnStartServer`
|
|
- `OnRebuildObservers`
|
|
- `Start()` function is called
|
|
|
|
## Callbacks in client mode
|
|
|
|
**When a client connects:**
|
|
|
|
- `OnStartClient`
|
|
- `OnStartLocalPlayer`
|
|
- `OnStartAuthority`
|
|
- `Start()` function is called
|
|
|
|
## Callbacks in host mode
|
|
|
|
These are only called on the **Player GameObjects** when a client connects:
|
|
|
|
- `OnStartServer`
|
|
- `OnStartClient`
|
|
- `OnRebuildObservers`
|
|
- `OnStartAuthority`
|
|
- `OnStartLocalPlayer`
|
|
- `Start()` function is called
|
|
- `OnSetLocalVisibility`
|
|
|
|
**On any remaining clients, when a client disconnects:**
|
|
|
|
- `OnNetworkDestroy`
|