Skip to content

Commit

Permalink
Support prefixed types in ClassInjector.SystemTypeFromIl2CppType
Browse files Browse the repository at this point in the history
  • Loading branch information
ds5678 committed Oct 5, 2024
1 parent aa36797 commit 7da7b67
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Il2CppInterop.Runtime/Injection/ClassInjector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7da7b67

Please sign in to comment.