Version: 2020.1
LanguageEnglish
  • C#

VisualElement.generateVisualContent

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

public Action<MeshGenerationContext> generateVisualContent;

Description

Called when the VisualElement visual contents need to be (re)generated.

When handled, it is possible to generate custom geometry in the content region of the VisualElement. This delegate is called only when the VisualElement has been detected to need to regenerate its visual contents. It is not called every frame when refreshing the panel. The content generated is cached and remains intact until a property on the VisualElement affecting visuals has changed or VisualElement.MarkDirtyRepaint is called. While executing code in a handler to this delegate, refrain from making changes to any property of the VisualElement. A correct handler should treat the VisualElement as 'read-only' and generate the geometry without causing side-effects. Changes done to the VisualElement during this event could be missed or lag appearance at best.

Did you find this page useful? Please give it a rating: