Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


RoundToPanelPixelSize(VisualElement, float)

Round the value so that it is a whole number of pixels on the target when rendered.
Read time 1 minuteLast updated 10 days ago

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.