Il2CppInterop
Il2CppInterop copied to clipboard
Loading asset bundles: System.ArgumentNullException: Value cannot be null. (Parameter 'meth')
What happened?
Hello! I'm trying to import an asset bundle into an IL2CPP game (built with Unity 2020.3.18 targeting Windows). Well I'm trying via RessourceStream (*note that the exact same error occurs with AssetBundle.LoadFromFile), and I have the following error.
namespace JarodMod;
[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
public class Plugin : BasePlugin
{
internal static new ManualLogSource Log;
public override void Load()
{
// Plugin startup logic
Log = base.Log;
Log.LogInfo($"Plugin {MyPluginInfo.PLUGIN_GUID} is loaded UPDATED!");
Harmony.CreateAndPatchAll(typeof(Plugin));
// AssetBundle
using var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("JarodMod.jarodbundle");
var assetBundle = AssetBundle.LoadFromMemory(stream!.ReadBytes());
Log.LogInfo("AssetBundle loaded successfully.");
}
}
I've built the Asset Bundle using the same version as the game (mentioned above). I hope you'll be able to help me with this issue. Thanks!
BepInEx Distribution
Bleeding Edge from BepisBuilds
Log outputs
[Error : BepInEx] Error loading [Jarod 1.0.0]: System.ArgumentNullException: Value cannot be null. (Parameter 'meth')
at System.Reflection.Emit.DynamicILGenerator.Emit(OpCode opcode, MethodInfo meth)
at Il2CppInterop.Runtime.InteropTypes.Il2CppObjectBase.InitializerStore`1.Create() in /home/runner/work/Il2CppInterop/Il2CppInterop/Il2CppInterop.Runtime/InteropTypes/Il2CppObjectBase.cs:line 124
at Il2CppInterop.Runtime.InteropTypes.Il2CppObjectBase.InitializerStore`1.get_Initializer() in /home/runner/work/Il2CppInterop/Il2CppInterop/Il2CppInterop.Runtime/InteropTypes/Il2CppObjectBase.cs:line 146
at Il2CppInterop.Runtime.Runtime.Il2CppObjectPool.Get[T](IntPtr ptr) in /home/runner/work/Il2CppInterop/Il2CppInterop/Il2CppInterop.Runtime/Runtime/Il2CppObjectPool.cs:line 40
at UnityEngine.AssetBundle.LoadFromMemory_Internal(Il2CppStructArray`1 binary, UInt32 crc)
at UnityEngine.AssetBundle.LoadFromMemory(Il2CppStructArray`1 binary)
at JarodMod.Plugin.Load() in E:\SteamLibrary\steamapps\common\Road 96\BepInEx\plugins\JarodMod\Plugin.cs:line 28
at BepInEx.Unity.IL2CPP.IL2CPPChainloader.LoadPlugin(PluginInfo pluginInfo, Assembly pluginAssembly) in /home/runner/work/BepInEx/BepInEx/Runtimes/Unity/BepInEx.Unity.IL2CPP/IL2CPPChainloader.cs:line 134
at BepInEx.Bootstrap.BaseChainloader`1.LoadPlugins(IList`1 plugins) in /home/runner/work/BepInEx/BepInEx/BepInEx.Core/Bootstrap/BaseChainloader.cs:line 411
Environment
- OS: Windows 10 22H2
- BepInEx: 6.0.0-be.697 (build commit `53625800b86f6c68751445248260edf0b27a71c2`)
- Game: Road 96