Edit

Share via


ButtonBackgroundSize Class

Definition

Caution

This component is no longer supported

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.

public ref class ButtonBackgroundSize : UnityEngine::MonoBehaviour
[System.Obsolete("This component is no longer supported", true)]
[UnityEngine.AddComponentMenu("Scripts/MRTK/Obsolete/ButtonBackgroundSize")]
[UnityEngine.ExecuteInEditMode]
public class ButtonBackgroundSize : UnityEngine.MonoBehaviour
[<System.Obsolete("This component is no longer supported", true)>]
[<UnityEngine.AddComponentMenu("Scripts/MRTK/Obsolete/ButtonBackgroundSize")>]
[<UnityEngine.ExecuteInEditMode>]
type ButtonBackgroundSize = class
    inherit MonoBehaviour
Public Class ButtonBackgroundSize
Inherits MonoBehaviour
Inheritance
UnityEngine.MonoBehaviour
ButtonBackgroundSize
Attributes
ObsoleteAttribute UnityEngine.AddComponentMenuAttribute UnityEngine.ExecuteInEditModeAttribute

Constructors

ButtonBackgroundSize()

Fields

ItemSize

The size of this object in 3D space, based on the scale factor. This value should match 2D design pixel values.

Methods

GetBasePixelScale()

Get the base pixel scale

GetSize()

Get the current size

SetBasePixelScale(Single)

Set the base pixel scale

SetSize(Vector3)

Set the size at Runtime or through code

Applies to