MarkComponentDirty<T>()
Marks the attached component of type T as changed, so that its [OnComponentChanged] handler runs once during the next update.
Read time 1 minuteLast updated 10 hours ago
Definition
- Type: Method
- Namespace: UnityEngine.UIElements
- Assembly: UnityEngine.UIElementsModule
public void MarkComponentDirty<T>() where T : struct, IVisualElementComponent
Remarks
Call this method after you change component data directly, for example by writing through . Unity doesn't detect direct writes, so without this call the handler doesn't run. You don't need to call this method when you use the generated setters or a data binding; both call it for you. If no component of type is attached to this element, this method does nothing.
ref GetComponent<T>()SetXxxTThis method only schedules the handler. It doesn't publish the change to bindings. To publish the change, call VisualElement.NotifyComponentChanged. To do both, use the field's generated setter when it's available. For a comparison of the ways to write component data, refer to VisualElementComponentAttribute.
SetXxx