Skip to content

Commit 7a56995

Browse files
WNP78ds5678
andauthored
Fix class injector abstract method handling (#134)
* Fix class injector abstract method handling to support newer unity versions where Il2CppParameterInfo doesn't exist. * Remove parameter name check and add return type check --------- Co-authored-by: Jeremy Pritts <49847914+ds5678@users.noreply.github.com>
1 parent 06cd048 commit 7a56995

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Il2CppInterop.Runtime/Injection/ClassInjector.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,14 +359,13 @@ static void FindAbstractMethods(List<INativeMethodInfoStruct> list, INativeClass
359359
{
360360
if (Marshal.PtrToStringAnsi(m.Name) != name) return false;
361361
if (m.ParametersCount != baseMethod.ParametersCount) return false;
362+
if (GetIl2CppTypeFullName(m.ReturnType) != GetIl2CppTypeFullName(baseMethod.ReturnType)) return false;
362363

363364
for (var i = 0; i < m.ParametersCount; i++)
364365
{
365366
var parameterInfo = UnityVersionHandler.Wrap(baseMethod.Parameters, i);
366367
var otherParameterInfo = UnityVersionHandler.Wrap(m.Parameters, i);
367368

368-
if (Marshal.PtrToStringAnsi(parameterInfo.Name) != Marshal.PtrToStringAnsi(otherParameterInfo.Name)) return false;
369-
370369
if (GetIl2CppTypeFullName(parameterInfo.ParameterType) != GetIl2CppTypeFullName(otherParameterInfo.ParameterType)) return false;
371370
}
372371

0 commit comments

Comments
 (0)