VisualElement.generateVisualContent

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.

对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答