From 8e9afa93dfdca7f4cea115bb981b7d9e41f524e9 Mon Sep 17 00:00:00 2001 From: Ploo <239304139+xinitrcn1@users.noreply.github.com> Date: Tue, 27 Jan 2026 14:28:50 +0000 Subject: [PATCH] Fix for unity 2022.3.62f3 not having get_graphicsDeviceID (#1235) --- BepInEx/Bootstrap/Chainloader.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/BepInEx/Bootstrap/Chainloader.cs b/BepInEx/Bootstrap/Chainloader.cs index 1a566d3..159e856 100644 --- a/BepInEx/Bootstrap/Chainloader.cs +++ b/BepInEx/Bootstrap/Chainloader.cs @@ -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; } }