[Unity Notes] Summary of UnityEventBase class

insert image description here


static function:

Function name return value Parameters that need to be passed in introduce
GetValidMethodInfo MethodInfo ①:object obj, ②:string functionName,③:Type[] argumentTypes Pass in an object with its function name and required parameters for the function ; return the matching method ( MethodInfo ).

Example function:

Function name return value Parameters that need to be passed in introduce
GetPersistentEventCount int without Get the number of registered persistent listeners.
GetPersistentMethodName string int index Gets the target method name of the persistent listener at index .
GetPersistentTarget Object int index Gets the target component of the persistent listener at index .
RemoveAllListeners null without Removes all non-persistent ( i.e. created from script ) listeners from the event.
SetPersistentListenerState null ①:int index, ②:UnityEventCallState state Modify the execution state of the persistent listener.

Recognize "persistent" and "non-persistent" listeners through UnityEvent:

insert image description here
insert image description here


Personal notes are for reference only, corrections are welcome

Guess you like

Origin blog.csdn.net/m0_55907341/article/details/123235815