Merge pull request #89 from ArkTarusov/fix/unity-2022-compatibility

Fix: Resolved InternalAPIHelper error in Unity 2022.3.23f1 and later
This commit is contained in:
Annulus Games 2024-06-20 11:39:01 +09:00 committed by GitHub
commit e395eecc7a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -39,6 +39,14 @@ namespace Alchemy.Editor
{ {
return (Type)methodInfo.Invoke(instance, new object[] { classType }); return (Type)methodInfo.Invoke(instance, new object[] { classType });
} }
#elif UNITY_2022_3_OR_NEWER
// Unity 2022.3.23f1 added a new parameter to the method
var version = UnityEditorInternal.InternalEditorUtility.GetUnityVersion();
if (version.Build >= 23)
{
return (Type)methodInfo?.Invoke(instance, new object[] { classType, isManagedReferenceProperty });
}
return (Type)methodInfo?.Invoke(instance, new object[] { classType });
#else #else
_ = isManagedReferenceProperty; // discard _ = isManagedReferenceProperty; // discard
return (Type)methodInfo.Invoke(instance, new object[] { classType }); return (Type)methodInfo.Invoke(instance, new object[] { classType });