Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

GenerateVisualContentAttribute

class in UnityEngine.UIElements

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

Description

Declares a static method of a VisualElementComponentAttribute struct as a painter that contributes to the owner element's VisualElement.generateVisualContent.

The method must be @@static void M(ref T self, MeshGenerationContext mgc). The source generator hooks it into the owner's generateVisualContent@@ when the component is added and unhooks it when the component is removed, and requests an initial repaint. Geometry changes re-run the painter through the engine, and [StyleProperty] changes repaint via the generated style handler, so no extra callbacks are needed.