以下行运行不正常,我不知道为什么。错误:System.Reflection.TargetParameterCountException:参数与签名不匹配
和有问题的代码行:
typeof(Resources).GetMethod("LoadAll", new Type[] { typeof(System.String), typeof(System.Type)});
显示 Resources 类的所有函数显示:
UnityEngine.Object[] FindObjectsOfTypeAll(System.Type)
T[] FindObjectsOfTypeAll[T]()
UnityEngine.Object Load(System.String)
T Load[T](System.String)
UnityEngine.Object Load(System.String, System.Type)
UnityEngine.ResourceRequest LoadAsync(System.String)
UnityEngine.ResourceRequest LoadAsync[T](System.String)
UnityEngine.ResourceRequest LoadAsync(System.String, System.Type)
UnityEngine.Object[] LoadAll(System.String, System.Type)
UnityEngine.Object[] LoadAll(System.String)
T[] LoadAll[T](System.String)
UnityEngine.Object GetBuiltinResource(System.Type, System.String)
T GetBuiltinResource[T](System.String)
Void UnloadAsset(UnityEngine.Object)
UnityEngine.AsyncOperation UnloadUnusedAssets()
Boolean Equals(System.Object)
Int32 GetHashCode()
System.Type GetType()
System.String ToString()
System.Reflection.MethodInfo[]
我正在尝试匹配 UnityEngine.Object[] LoadAll(System.String, System.Type)。关于可能是什么问题的任何想法?
如果您可以创建一行返回“T[] LoadAllT”的方法信息对象,则特定于给定类型。