Class ButtonBackgroundSize
The base layout component for a button or UI elements - easily build UI with Unity Primitives. Helps to create consistency by using values that scale to a designer's 2D layout program. Based on a ratio of 2048 pixels for 1 meter of surface area.
Use case: A designer creates a concept image of UI based on a 2048 artboard. 2048 pixels is a nice resolution for a meter of content, two meters away from the user. The FOV of the HoloLens is about 1 meter wide at 2 meters from the user meaning the designer can assume an image area of 2048 x 1184 pixels at 2 meters from the user. The designer or engineer can take pixel based redlines and create UI at 1:1 scale.
Namespace: Microsoft.MixedReality.Toolkit.UI
Assembly: cs.temp.dll.dll
Syntax
[Obsolete("This component is no longer supported", true)]
public class ButtonBackgroundSize : MonoBehaviour
Fields
ItemSize
The size of this object in 3D space, based on the scale factor. This value should match 2D design pixel values.
Declaration
protected Vector3 ItemSize
Field Value
Type | Description |
---|---|
Vector3 |
Methods
GetBasePixelScale()
Get the base pixel scale
Declaration
public float GetBasePixelScale()
Returns
Type | Description |
---|---|
Single |
GetSize()
Get the current size
Declaration
public Vector3 GetSize()
Returns
Type | Description |
---|---|
Vector3 |
SetBasePixelScale(Single)
Set the base pixel scale
Declaration
public void SetBasePixelScale(float scale)
Parameters
Type | Name | Description |
---|---|---|
Single | scale |
SetSize(Vector3)
Set the size at Runtime or through code
Declaration
public void SetSize(Vector3 size)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | size |