文档

Unity Engine

Unity Engine

RoundToPanelPixelSize(VisualElement, float)

Round the value so that it is a whole number of pixels on the target when rendered.
阅读时间1 分钟最后更新于 1 个月前

Definition

public static float RoundToPanelPixelSize(this VisualElement ve, float v)

Parameters

Returns

Type

Description

float

Remarks

It will only work on visualElements inside a panel.
Is is used to get dimensions repesenting whole pixels used for layout values, translations or in the generation of the visual Content. It does not consider the transform of the element and its ancestors.
This method uses the scaling from [see cref="VisualElement.scaledPixelsPerPoint"/> and uses the same rounding thresholds as the layout engine.