diff --git a/BepInEx.IL2CPP/IL2CPPChainloader.cs b/BepInEx.IL2CPP/IL2CPPChainloader.cs index 05a4365..b5d5276 100644 --- a/BepInEx.IL2CPP/IL2CPPChainloader.cs +++ b/BepInEx.IL2CPP/IL2CPPChainloader.cs @@ -68,7 +68,14 @@ namespace BepInEx.IL2CPP ClassInjector.Detour = new UnhollowerDetourHandler(); var gameAssemblyModule = Process.GetCurrentProcess().Modules.Cast() - .First(x => x.ModuleName.Contains("GameAssembly")); + .FirstOrDefault(x => x.ModuleName.Contains("GameAssembly") || + x.ModuleName.Contains("UserAssembly")); + + if (gameAssemblyModule == null) + { + Logger.LogFatal("Could not locate Il2Cpp game assembly (GameAssembly.dll) or (UserAssembly.dll). The game might be obfuscated or use a yet unsupported build of Unity."); + return; + } gameAssemblyModule.BaseAddress.TryGetFunction("il2cpp_runtime_invoke", out var runtimeInvokePtr); PreloaderLogger.Log.LogDebug($"Runtime invoke pointer: 0x{runtimeInvokePtr.ToInt64():X}");