/// <summary> /// Automatically invokes the method based on its type (instance/ static) /// </summary> /// <param name="method">Method to be invoked</param> /// <param name="objects">Target objects</param> /// <param name="parameters">Parameters of the method</param> /// <returns>The string describing result of the execution or error message (discardable)</returns> public static string AutoInvoke(this MethodBase method, UnityEngine.Object[] objects, object[] parameters) { return(method.AutoInvoke(objects, _ => true, parameters)); }
/// <summary> /// Automatically invokes the method based on its type (instance/ static) /// </summary> /// <remarks> /// For instance method, this will invokes on all objects satisfying the predicate. /// </remarks> /// <param name="method">Method to be invoked</param> /// <param name="predicate">Predicate for filtering objects</param> /// <param name="parameters">Parameters of the method</param> /// <returns>The string describing result of the execution or error message (discardable)</returns> public static string AutoInvoke(this MethodBase method, Func <UnityEngine.Object, bool> predicate, object[] parameters) { return(method.AutoInvoke(UnityEngine.Object.FindObjectsOfType(method.ReflectedType), predicate, parameters)); }
/// <summary> /// Automatically invokes the method based on its type (instance/ static) /// </summary> /// <remarks> /// For instance method, this will invokes on all objects. /// </remarks> /// <param name="method">Method to be invoked</param> /// <param name="parameters">Parameters of the method</param> /// <returns>The string describing result of the execution or error message (discardable)</returns> public static string AutoInvoke(this MethodBase method, object[] parameters) { return(method.AutoInvoke(UnityEngine.Object.FindObjectsOfType(method.ReflectedType), _ => true, parameters)); }