mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
refactor: configure frame rate in a virtual method (#638)
Moved frame rate configuration into a virtual method so that people can override it and we reduce StartServer complexity Fixes #567
This commit is contained in:
parent
2d492607c8
commit
a495f66fc1
@ -240,13 +240,8 @@ internal void RegisterServerMessages()
|
||||
NetworkServer.RegisterHandler<ErrorMessage>(OnServerErrorInternal);
|
||||
}
|
||||
|
||||
public bool StartServer()
|
||||
public virtual void ConfigureServerFrameRate()
|
||||
{
|
||||
InitializeSingleton();
|
||||
|
||||
if (runInBackground)
|
||||
Application.runInBackground = true;
|
||||
|
||||
// set a fixed tick rate instead of updating as often as possible
|
||||
// * if not in Editor (it doesn't work in the Editor)
|
||||
// * if not in Host mode
|
||||
@ -257,6 +252,16 @@ public bool StartServer()
|
||||
Debug.Log("Server Tick Rate set to: " + Application.targetFrameRate + " Hz.");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public bool StartServer()
|
||||
{
|
||||
InitializeSingleton();
|
||||
|
||||
if (runInBackground)
|
||||
Application.runInBackground = true;
|
||||
|
||||
ConfigureServerFrameRate();
|
||||
|
||||
if (!NetworkServer.Listen(maxConnections))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user