があるのでEditor拡張で
(target as MonoBehaviour).Invoke("HogeMethod", 0f);
とかやることがあると思う。
ちなみに第2引数は秒数なのでHogeMethod
に渡したい引数ではない・・。
using System; using System.Reflection
public static void InvokeWithArgs(this MonoBehaviour target, string methodName, object[] args) { Type t = target.GetType(); // BindingFlagsがないとnullが返ることがあるので、ものによってはここを随時変えないとダメかも? MethodInfo m = t.GetMethod("SetActiveAttackUI", BindingFlags.NonPublic | BindingFlags.Instance); m.Invoke(target, args); }
これで行けるかも?
object[] args = { bar, hoge }; (target as MonoBehaviour).InvokeWithArgs("HogeMethod", args);
ではなく、
object[] args = { bar, hoge }; (target as 実際のクラス名).InvokeWithArgs("HogeMethod", args);
としないといけないかもしれない。