Wanzyee Studio

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...
 
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...
 

Detailed Description

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.

Member Function Documentation

static bool IsSupported ( MethodInfo  method)
static

Determine if the specified method is supported, i.e., non-generic and all parameter types are supported.

Parameters
methodMethod.
Returns
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.

Parameters
methodInfoMethod info.
instanceInstance.
parametersParameters.
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.

Template Parameters
TThe method return value type.
Returns
The value returned by the method.

Member Data Documentation

Object instance => (null == methodInfo || methodInfo.IsStatic) ? null : _instance

Get the method instance target.

Property Documentation

MethodInfo methodInfo
get

Get the MethodInfo found with serialized type, name, and parameter types.

object [] parameters
get

Get the parameter values passed to the method.

object result
get

Get the result returned by the last time method invoking.