ScriptReference/UIElements.VisualElement-generateVisualContent #86
Replies: 2 comments
-
|
If nothing is being drawn, check that:
If these are not your problem, start with the simple case (drawing a large triangle/quad) in a basic element and work your way upwards to drawing complex content. Footnotes
|
Beta Was this translation helpful? Give feedback.
0 replies
-
|
As of 2022.1 you should generally use /// <summary>
/// Draws a 1px wide circle aligned in the center of the element.
/// </summary>
private static void GenerateVisualContent(MeshGenerationContext obj)
{
const int pixelWidth = 1;
Rect dimensions = obj.visualElement.contentRect;
float radius = Math.Min(dimensions.width, dimensions.height) * 0.5f - pixelWidth ;
Painter2D p2d = obj.painter2D;
p2d.lineWidth = pixelWidth;
p2d.strokeColor = Color.white;
p2d.BeginPath();
p2d.Arc(dimensions.center, radius, 0, Angle.Turns(1));
p2d.Stroke();
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
ScriptReference/UIElements.VisualElement-generateVisualContent
https://docs.unity3d.com/ScriptReference/UIElements.VisualElement-generateVisualContent.html
Beta Was this translation helpful? Give feedback.
All reactions