From 7da7b67bb074ea806ef64890fdc9f29a40a12a48 Mon Sep 17 00:00:00 2001 From: ds5678 <49847914+ds5678@users.noreply.github.com> Date: Sun, 8 Sep 2024 09:19:50 -0700 Subject: [PATCH] Support prefixed types in ClassInjector.SystemTypeFromIl2CppType --- Il2CppInterop.Runtime/Injection/ClassInjector.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Il2CppInterop.Runtime/Injection/ClassInjector.cs b/Il2CppInterop.Runtime/Injection/ClassInjector.cs index 6db08110..735929b2 100644 --- a/Il2CppInterop.Runtime/Injection/ClassInjector.cs +++ b/Il2CppInterop.Runtime/Injection/ClassInjector.cs @@ -1147,7 +1147,9 @@ private static string GetIl2CppTypeFullName(Il2CppTypeStruct* typePointer) internal static Type SystemTypeFromIl2CppType(Il2CppTypeStruct* typePointer) { var fullName = GetIl2CppTypeFullName(typePointer); - var type = Type.GetType(fullName) ?? throw new NullReferenceException($"Couldn't find System.Type for Il2Cpp type: {fullName}"); + var type = Type.GetType(fullName) + ?? Type.GetType(fullName.Contains('.') ? "Il2Cpp" + fullName : "Il2Cpp." + fullName) + ?? throw new NullReferenceException($"Couldn't find System.Type for Il2Cpp type: {fullName}"); INativeTypeStruct wrappedType = UnityVersionHandler.Wrap(typePointer); if (wrappedType.Type == Il2CppTypeEnum.IL2CPP_TYPE_GENERICINST)