# MarkComponentDirty<T>()

> Marks the attached component of type T as changed, so that its [OnComponentChanged] handler runs once during the next update.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.UIElements](/engine/6000.7/script-reference/unityengine/uielements.md)
* **Assembly:** UnityEngine.UIElementsModule

```csharp
public void MarkComponentDirty<T>() where T : struct, IVisualElementComponent
```

### Remarks

Call this method after you change component data directly, for example by writing through `ref GetComponent<T>()`. 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 `SetXxx` setters or a data binding; both call it for you. If no component of type `T` is attached to this element, this method does nothing.
