Class UnityPercentLayoutElement
Drives a UnityEngine.UI.LayoutElement's preferred size to a percentage of its parent's size along
one axis, realizing the CSS % unit for a composite-view child. Unity's
UnityEngine.UI.LayoutElement has no native percentage support, so this component recomputes the
concrete pixel size whenever the parent's dimensions change.
Namespace: Serenity.Ui.Infrastructure.Views
Assembly: Serenity.UnityUi.Infrastructure.dll
Syntax
public class UnityPercentLayoutElement : MonoBehaviour
Constructors
UnityPercentLayoutElement()
Declaration
public UnityPercentLayoutElement()
Methods
Configure(float, bool, bool, float, bool, float)
Configures the percentage sizing for this element.
Declaration
public void Configure(float percent, bool horizontal, bool hasMin, float min, bool hasMax, float max)
Parameters
| Type | Name | Description |
|---|---|---|
| float | percent | Fraction of the parent's axis to occupy, expressed as 0..100. |
| bool | horizontal | True to size along the parent's width, false for its height. |
| bool | hasMin | Whether a minimum-pixels clamp applies. |
| float | min | Minimum size in pixels when |
| bool | hasMax | Whether a maximum-pixels clamp applies. |
| float | max | Maximum size in pixels when |