Wrap a method to be invoked by UnityEngine.Events.UnityEvent
.
More...
Inherits MonoBehaviour, and ISerializationCallbackReceiver.
Public Member Functions | |
void | SetMethod (MethodInfo methodInfo, Object instance, params object[] parameters) |
Set the method, instance target, and the parameter values manually. More... | |
void | Invoke () |
Invoke the method set by this if enabled. More... | |
T | InvokeCall< T > () |
Invoke the method set by this with returned value if enabled, otherwise return the default value. More... | |
Static Public Member Functions | |
static bool | IsSupported (MethodInfo method) |
Determine if the specified method is supported, i.e., non-generic and all parameter types are supported. More... | |
Public Attributes | |
Object | instance => (null == methodInfo || methodInfo.IsStatic) ? null : _instance |
Get the method instance target. More... | |
Properties | |
MethodInfo | methodInfo [get] |
Get the MethodInfo found with serialized type, name, and parameter types. More... | |
object[] | parameters [get] |
Get the parameter values passed to the method. More... | |
object | result [get] |
Get the result returned by the last time method invoking. More... | |
Wrap a method to be invoked by UnityEngine.Events.UnityEvent
.
Support static method and multiple parameters which can be edited in the Inspector GUI. Set the instance to invoke, or null
for a static method, then pick the method by the popup menu. Trick to select an editor static method, press "Ctrl" and click the menu.
The parameter value, array, or list, of types below are supported:
enum
, bool
, string
, int
, long
, float
, double
.UnityEngine.Object
, include others derive from it.UnityEngine.Vector2
, UnityEngine.Vector3
, UnityEngine.Vector4
.UnityEngine.Quaternion
, UnityEngine.Matrix4x4
.UnityEngine.Rect
, UnityEngine.RectOffset
, UnityEngine.Bounds
.UnityEngine.Color
, UnityEngine.Color32
, UnityEngine.Gradient
.UnityEngine.AnimationCurve
, UnityEngine.LayerMask
, UnityEngine.GUIContent
.
|
static |
Determine if the specified method is supported, i.e., non-generic and all parameter types are supported.
method | Method. |
true
if is supported; otherwise, false
.void SetMethod | ( | MethodInfo | methodInfo, |
Object | instance, | ||
params object[] | parameters | ||
) |
Set the method, instance target, and the parameter values manually.
methodInfo | Method info. |
instance | Instance. |
parameters | Parameters. |
void Invoke | ( | ) |
Invoke the method set by this if enabled.
T InvokeCall< T > | ( | ) |
Invoke the method set by this with returned value if enabled, otherwise return the default value.
T | The method return value type. |
Object instance => (null == methodInfo || methodInfo.IsStatic) ? null : _instance |
Get the method instance target.
|
get |
Get the MethodInfo
found with serialized type, name, and parameter types.
|
get |
Get the parameter values passed to the method.
|
get |
Get the result returned by the last time method invoking.