Network Manager
The network manager is very core to this system. This is where everything starts. If this is NOT in the very first scene of your project it will not work properly with your project.
I have a series of example pre-built network manager prefabs for you to take advantage of found in these locations (relative to the EasyMultiplayer-Invector directory):
EasyMultiplayer-Invector/Basic Locomotion/PreBuiltPrefabs/BasicNetworkManager.prefab
EasyMultiplayer-Invector/Melee Combat/PreBuiltPrefabs/No Inventory/MeleeNetworkManager_NoInventory.prefab
EasyMultiplayer-Invector/Melee Combat/PreBuiltPrefabs/Inventory/UI/MeleeNetworkManager_Inventory.prefab
EasyMultiplayer-Invector/Shooter/PreBuiltPrefabs/NoInventory/ShooterNetworkManager_NoInventory.prefab
EasyMultiplayer-Invector/Shooter/PreBuiltPrefabs/ShooterMelee/Core/ShooterNetworkManager_ShooterMelee.prefab
You can start with one of these to save you some setup time according to your needs. So for example if you wanted to have a project use the Shooter Template with a NoInventory system you would want to use the network manager found here:
EasyMultiplayer-Invector/Shooter/PreBuiltPrefabs/NoInventory/ShooterNetworkManager_NoInventory.prefab
When testing with your network manager I often find it nice to have the scene holding it be empty and have it always additively loaded in my editor for me to quickly update it as needed.
Copy the prefab to a new location so you don't modify the original if you ever want to update this package in the future
Configuration Options
| Configuration Name | Description |
|---|---|
| Dont Destroy On Load | Self explanitory, this will not be destroyed when scenes are loaded. Leave this off for most scenarios. All scenes are always additevely loaded in this project by the Network Manager. The only time this isn't true is for the Offline Scene |
| Persist Newtork Manager To Offline Scene | This will not destroy the network manager when traveling to the Offline Scene |
| Run In Background | This should always be true. You can read more in depth about this on Mirrors docs. This is for advanced use cases only |
| Auto Start Server Build | This should always be true. When running a server build the network manager will not start the server unless this is ticked. You can manually start the server if you want, this is for advanced users only. |
| Server Tick Rate | How fast, or slow, you want to send packets across the network. This is the general rule: Turn Based = 1 - 10Hz, MMO = 30Hz, FPS\Real Time Combat = 60Hz. You can read more details about this on Mirrors docs |
| Offline Scene | The scene to load (not addively) when you are disconnected from the server |
| Online Scene | The scene to load (not addively) when you are connected to the server |
| Transport | What type of transport you want to use, there are many (Epic, Fizzy, KCP, etc.) read about the available transports and what their benefits/drawbacks are on mirrors docs |
| Network Address | This should generally be dynamic according to your own code but is localhost by default. This is the server address you want to connect to as a client. This can be a dns name or ip address. |
| Max Connections | The maximum number of connections that will be allowed to connect to this server |
| Disconnect Inactive Connections | If a client isn't sending any information they should be disconnected. If you enable this |
| Disconnect Inactive Timeout | How long to wait, in seconds, before disconnecting an inactive client |
| Authenticator | Look at mirrors docs, if you want to have some form of authentication required to connect to this server |
| Player Prefab | This should always be the ClientConnection prefab (unless you override it with some of your own additional information). Using a custom prefab that you make here is for advanced use cases only. This prefab holds client connection information and is the owner of all objects the client may create. |
| Auto Create Player | If you want to immediately generate the Player Prefab or not. I can't think of a situation you wouldn't want to do this. However, I leave this option here for you. |
| Player Spawn Method | This is something you can completely ignore as this is overriden by my own custom code. Does nothing |
| Character To Spawn | The character prefab for a connecting client |
| Teams | The TeamData that all Teams components will inherit if they don't specify their own. Read more about what TeamData is in this documentation. |
| Character Team | The team name that you, as a client, are a member of. This should not be set manually, but dynamically via code (unless you're manually testing team mechanics) |
| Auto Spawn Character | If you want to automatically spawn the Character To Spawn when you are finished connecting to the server and having finished loaded the Online Scene. This is only possible if you have enabled Auto Create Player. |
| Debug Window | If you want to have a custom debug window that you can open with the ~ key at runtime. This should NOT be enabled for production builds. |
| Verbose Logging | If you want the network manager to console log everything its doing. Great for debugging. This should NOT be enabled for production builds. |
| Additively Load Scnese On Join | A list of scenes that you want to load additively when you first join the server. |
| Move To Scene On Join | The scene to move the Character To Spawn to after successfully loading the scene and connecting to the server. |
| Jump To Point Name | The name of any object that is tagged with NewtorkSpawnPoint that you want to immediately jump your Character To Spawn to after they have finished loading the scene, optionally moving to it, and joining the server. It's important to note that this point name will be relative to the scene the character is in. So make sure that you are moving them to the proper scene holding this object. |