mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Utils.IsHeadless so it can be reused by other classes if needed.
This commit is contained in:
parent
2a9d7e2df3
commit
d3afa9f26f
@ -57,9 +57,9 @@ public class NetworkManager : MonoBehaviour
|
||||
public int numPlayers => NetworkServer.connections.Count(kv => kv.Value.playerController != null);
|
||||
|
||||
// runtime data
|
||||
// this is used to make sure that all scene changes are initialized by UNET.
|
||||
// this is used to make sure that all scene changes are initialized by UNET.
|
||||
// Loading a scene manually wont set networkSceneName, so UNET would still load it again on start.
|
||||
public static string networkSceneName = "";
|
||||
public static string networkSceneName = "";
|
||||
[NonSerialized]
|
||||
public bool isNetworkActive;
|
||||
public NetworkClient client;
|
||||
@ -85,7 +85,7 @@ public virtual void Awake()
|
||||
InitializeSingleton();
|
||||
|
||||
// headless mode? then start the server
|
||||
if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Null && startOnHeadless)
|
||||
if (Utils.IsHeadless() && startOnHeadless)
|
||||
{
|
||||
Application.targetFrameRate = 60;
|
||||
StartServer();
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
namespace Mirror
|
||||
{
|
||||
@ -184,5 +185,11 @@ public static float[] UnpackUShortIntoThreeFloats(ushort combined, float minTarg
|
||||
float w = ScaleByteToFloat(upper, 0x00, 0x1F, minTarget, maxTarget);
|
||||
return new float[]{u, v, w};
|
||||
}
|
||||
|
||||
// headless mode detection
|
||||
public static bool IsHeadless()
|
||||
{
|
||||
return SystemInfo.graphicsDeviceType == GraphicsDeviceType.Null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user