기술 자료

Unity Engine

Unity Engine

RegisterCallbackAttribute

Declares a static method of a component struct as an event handler for the element the component is attached to.
읽는 시간 4분최근 업데이트: 20일 전

Definition

[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)]public class RegisterCallbackAttribute : Attribute

Remarks

Apply this attribute to a static method of a struct that has the VisualElementComponentAttribute. When the component is added to an element, the method is registered as a callback for RegisterCallbackAttribute.eventType on that element; when the component is removed, the callback is unregistered.
Apply the attribute several times to handle several event types with the same method. Unity's source generator validates the method signature and generates the registration code.

Constructors

Properties

Property

Description

callbackOptionsOptions that control how the callback is registered, such as CallbackOptions.TrickleDown.
eventTypeThe type of event to handle, for example
typeof(PointerDownEvent)
.

Inheritance

Inherited Members