Reflective Network Manager
This class inherits the NetworkManager
class, a base class that provides Mirror's networking capabilities. This code customizes the basic network functionality required for network games.
Members
public bool IsAutoPrefabSearcher;
When it is active, it searches for a folder named Spawnable Prefabs in the resources folder and loads all objects in it.
public bool IsFolderSearch;
When it is active, it allows you to select a folder and the objects in the folder are loaded.
public string SpawnablePrefabsPath;
It keeps the path information where the prefabs are located.
Methods
A function called when the server starts.
Get the list of spawnable objects using
NetworkSpawnUtilities.GetSpawnablePrefabs()
.ConnectionManager.networkConnections.OnStartedServer
event is triggered.If IsAutoPrefabSearcher is true, we take the list of spawnable prefabs and assign them to the spawnPrefabs variable.
A function that is called when the client is started.
A list of spawnable objects is received.
The
ConnectionManager.networkConnections.OnStartedClient
event is triggered.
A function called when the server is stopped.
The
ConnectionManager.networkConnections.OnStoppedServer
event is triggered.
A function called when the client is stopped.
The
ConnectionManager.networkConnections.OnStoppedClient
event is triggered.If the network server is active, we return it because this means it is the host.
If IsAutoPrefabSearcher is true, we get the list of spawnable prefabs and register them to the client.
A function that is called when a client connects to the server.
With the
NetworkConnectionToClient
parameter, theConnectionManager.networkConnections.OnServerConnected
event is triggered.
A function called when a client leaves the server.
First, the base class is called to this operation with the
NetworkConnectionToClient
parameter.The
ConnectionManager.networkConnections.OnServerDisconnected
event is triggered.
A function that is called when the client successfully connects to the server.
First, the base class is called to this operation.
The
ConnectionManager.networkConnections.OnClientConnected
event is triggered.
A function called when the client leaves the server.
First, the base class is called to this operation.
The
ConnectionManager.networkConnections.OnClientDisconnected
event is triggered.
If the AutoCreatePlayer variable is true for the client during scene changes,
it performs the operation of adding a player.
Since this operation conflicts with the scene changing process of the scene room,
we override the method.
Last updated