diff --git a/src/Core/Runtime/Il2Cpp/Il2CppProvider.cs b/src/Core/Runtime/Il2Cpp/Il2CppProvider.cs index daefa33..64091d9 100644 --- a/src/Core/Runtime/Il2Cpp/Il2CppProvider.cs +++ b/src/Core/Runtime/Il2Cpp/Il2CppProvider.cs @@ -98,15 +98,17 @@ namespace UnityExplorer.Core.Runtime.Il2Cpp internal delegate IntPtr d_FindObjectsOfTypeAll(IntPtr type); + internal static readonly string[] findObjectsOfTypeAllSignatures = new[] + { + "UnityEngine.Resources::FindObjectsOfTypeAll", + "UnityEngine.ResourcesAPIInternal::FindObjectsOfTypeAll" // Unity 2020+ updated to this + }; + public override UnityEngine.Object[] FindObjectsOfTypeAll(Type type) { - var iCall = ICallManager.GetICallUnreliable(new[] - { - "UnityEngine.Resources::FindObjectsOfTypeAll", - "UnityEngine.ResourcesAPIInternal::FindObjectsOfTypeAll" // Unity 2020+ updated to this - }); - - return new Il2CppReferenceArray(iCall.Invoke(Il2CppType.From(type).Pointer)); + return new Il2CppReferenceArray( + ICallManager.GetICallUnreliable(findObjectsOfTypeAllSignatures) + .Invoke(Il2CppType.From(type).Pointer)); } // Scene.GetRootGameObjects();