Utils.IsHeadless so it can be reused by other classes if needed.

This commit is contained in:
vis2k 2019-02-22 20:43:25 +01:00
parent 2a9d7e2df3
commit d3afa9f26f
2 changed files with 10 additions and 3 deletions

View File

@ -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();

View File

@ -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;
}
}
}