lundi 19 février 2018

Reflection GetMethod with a type paramenter

The following line is not running properly, and I'm not sure why. The Error: System.Reflection.TargetParameterCountException: parameters do not match signature

And the line of code in question:

typeof(Resources).GetMethod("LoadAll", new Type[] { typeof(System.String), typeof(System.Type)});

Displaying all functions of the Resources class shows:

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[]

I'm trying to match UnityEngine.Object[] LoadAll(System.String, System.Type). Any thoughts on what may be the issue?

Bonus if you can make a line that returns a methodinfo object for "T[] LoadAllT", specific to a given type.





Aucun commentaire:

Enregistrer un commentaire