Fix for unity 2022.3.62f3 not having get_graphicsDeviceID (#1235)

This commit is contained in:
Ploo authored and GitHub committed 2026-01-27 15:28:50 +01:00
1 parent 02413dd28c
commit 8e9afa93df
1 file changed
+7 -1
+7 -1
View File
@@ -48,7 +48,13 @@ namespace BepInEx.Bootstrap
var prop = AccessTools.PropertyGetter(typeof(Application), "isBatchMode");
if (prop != null)
return (bool) prop.Invoke(null, null);
return SystemInfo.graphicsDeviceID == 0;
// Some Unity builds may miss this property, see
// https://docs.unity3d.com/2022.3/Documentation/ScriptReference/SystemInfo-graphicsDeviceID.html
var prop2 = AccessTools.PropertyGetter(typeof(SystemInfo), "graphicsDeviceID");
if (prop2 != null)
return ((int) prop2.Invoke(null, null)) == 0;
return false;
}
}