Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


FloorToPanelPixelSize(VisualElement, float)

Return the next smaller value representing a whole number of pixels on the target when rendered.
Read time 1 minuteLast updated 7 days ago

Definition

public static float FloorToPanelPixelSize(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.