Version: Unity 6.6 Alpha (6000.6)
LanguageEnglish
  • C#

EventCallback.Create

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static EventCallbackDefinition Create(EventCallback<TEvent> userCallback, TrickleDown useTrickleDown, bool invokeOnce);

Parameters

Parameter Description
userCallback The delegate called when this callback is triggered.
useTrickleDown Whether this callback is triggered during the TrickleDown phase of the event propagation or not. If not, it will be triggered during the BubbleUp phase (default).
invokeOnce If true, callback will be unregistered automatically when invoked.

Returns

EventCallbackDefinition The created callback instance

Description

Creates a callback instance that will call the given userCallback delegate when registered on an element that is part of the propagation chain of any event of type TEvent.


Declaration

public static EventCallbackDefinition<TElement> Create(EventCallback<TEvent, TElement> userCallback, TrickleDown useTrickleDown, bool invokeOnce);

Parameters

Parameter Description
userCallback The delegate called when this callback is triggered.
useTrickleDown Whether this callback is triggered during the TrickleDown phase of the event propagation or not. If not, it will be triggered during the BubbleUp phase (default).
invokeOnce If true, callback will be unregistered automatically when invoked.

Returns

EventCallbackDefinition<TElement> The created callback instance

Description

Creates a callback instance that will call the given userCallback delegate when registered on an element that is part of the propagation chain of any event of type TEvent. The delegate will always be called with its second argument set to the element on which it's registered.


Declaration

public static EventCallbackDefinition Create(EventCallback<TEvent, TArg> userCallback, EventArg<TArg> arg, TrickleDown useTrickleDown, bool invokeOnce);

Parameters

Parameter Description
userCallback The delegate called when this callback is triggered.
arg The identifier used to send specific argument values to the delegate for any element on which this callback is registered.
useTrickleDown Whether this callback is triggered during the TrickleDown phase of the event propagation or not. If not, it will be triggered during the BubbleUp phase (default).
invokeOnce If true, callback will be unregistered automatically when invoked.

Returns

EventCallbackDefinition The created callback instance

Description

Creates a callback instance that will call the given userCallback delegate when registered on an element that is part of the propagation chain of any event of type TEvent. The delegate will be called with its second argument set to whichever value the arg parameter holds for the element on which it's registered.