mirror of
https://github.com/BepInEx/BepInEx.git
synced 2026-10-20 01:46:13 +00:00
UnityLogSource's static constructor falls back to Application.RegisterLogCallback when Application.logMessageReceived is absent. Unity's managed code stripper can remove both, in which case GetMethod returns null and the unguarded Invoke throws a NullReferenceException out of the static constructor. That exception propagates through chainloader initialisation, so the chainloader never starts and no plugins load. The failure is close to undiagnosable: LogOutput.log ends at "Preloader finished" with no error, and the exception only appears on stdout. Unity log forwarding is optional, so warn and continue instead of taking the whole loader down. Seen on Beacon Pines (Unity 2021.3.45f1, Mono), whose UnityEngine.Application has neither member.