Class BoundsIntField
A UI component that allows users to input and edit integer bounds values with position and size in 3D space.
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
[UxmlElement]
public class BoundsIntField : BaseVisualElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IContextOverrideElement, IAdditionalDataHolder, IInputElement<BoundsInt>, IValidatableElement<BoundsInt>, ISizeableElement, INotifyValueChanging<BoundsInt>, INotifyValueChanged<BoundsInt>
Remarks
The BoundsIntField is a specialized input component designed for editing BoundsInt values in Unity applications. It provides a user-friendly interface for manipulating 3D bounds defined by integer coordinates, consisting of a position (x, y, z) and size (width, height, depth).
The component is organized into two rows: one for position coordinates and another for size dimensions. Each row contains three integer input fields for the respective x, y, and z values.
The BoundsIntField is particularly useful when working with grid-based systems, tile maps, or any scenario requiring precise integer-based 3D boundaries.
Examples
Basic usage example showing how to create and configure a BoundsIntField.
Creating a BoundsIntField with validation and change callback.
var boundsField = new BoundsIntField();
boundsField.value = new BoundsInt(Vector3Int.zero, new Vector3Int(1, 1, 1));
boundsField.validateValue = (bounds) => bounds.size.x > 0 && bounds.size.y > 0 && bounds.size.z > 0;
// Register to value changes
boundsField.RegisterValueChangedCallback(evt => {
Debug.Log($"New bounds: Pos(), Size()");
});
UXML definition example.
Defining a BoundsIntField in UXML.
<UXML xmlns:appui="Unity.AppUI.UI">
<appui:BoundsIntField
size="M"
value="0,0,0,1,1,1"
name="myBoundsField"
/>
</UXML>
USS styling example.
Styling the BoundsIntField with USS.
.appui-boundsfield {
margin: 8px;
}
.appui-boundsfield__row {
flex-direction: row;
align-items: center;
}
.appui-boundsfield__label {
min-width: 60px;
}
Constructors
BoundsIntField()
Default constructor.
Declaration
public BoundsIntField()
Fields
labelUssClassName
The BoundsIntField Label styling class.
Declaration
public const string labelUssClassName = "appui-boundsfield__label"
Field Value
| Type | Description |
|---|---|
| string |
rowUssClassName
The BoundsIntField row styling class.
Declaration
public const string rowUssClassName = "appui-boundsfield__row"
Field Value
| Type | Description |
|---|---|
| string |
sizeUssClassName
The BoundsIntField size styling class.
Declaration
public const string sizeUssClassName = "appui-boundsfield--size-"
Field Value
| Type | Description |
|---|---|
| string |
sxFieldUssClassName
The BoundsIntField X NumericalField styling class.
Declaration
public const string sxFieldUssClassName = "appui-boundsfield__sx-field"
Field Value
| Type | Description |
|---|---|
| string |
syFieldUssClassName
The BoundsIntField Y NumericalField styling class.
Declaration
public const string syFieldUssClassName = "appui-boundsfield__sy-field"
Field Value
| Type | Description |
|---|---|
| string |
szFieldUssClassName
The BoundsIntField Z NumericalField styling class.
Declaration
public const string szFieldUssClassName = "appui-boundsfield__sz-field"
Field Value
| Type | Description |
|---|---|
| string |
ussClassName
The BoundsIntField main styling class.
Declaration
public const string ussClassName = "appui-boundsfield"
Field Value
| Type | Description |
|---|---|
| string |
xFieldUssClassName
The BoundsIntField X NumericalField styling class.
Declaration
public const string xFieldUssClassName = "appui-boundsfield__x-field"
Field Value
| Type | Description |
|---|---|
| string |
yFieldUssClassName
The BoundsIntField Y NumericalField styling class.
Declaration
public const string yFieldUssClassName = "appui-boundsfield__y-field"
Field Value
| Type | Description |
|---|---|
| string |
zFieldUssClassName
The BoundsIntField Z NumericalField styling class.
Declaration
public const string zFieldUssClassName = "appui-boundsfield__z-field"
Field Value
| Type | Description |
|---|---|
| string |
Properties
contentContainer
The content container of the BoundsIntField. Always null.
Declaration
public override VisualElement contentContainer { get; }
Property Value
| Type | Description |
|---|---|
| VisualElement |
Overrides
invalid
Set the validation state of the BoundsIntField.
Declaration
[CreateProperty]
[UxmlAttribute]
public bool invalid { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
size
The BoundsIntField size.
Declaration
[CreateProperty]
[UxmlAttribute]
[Header("BoundsInt Field")]
public Size size { get; set; }
Property Value
| Type | Description |
|---|---|
| Size |
validateValue
The validation function to use on the BoundsIntField value.
Declaration
[CreateProperty]
public Func<BoundsInt, bool> validateValue { get; set; }
Property Value
| Type | Description |
|---|---|
| Func<BoundsInt, bool> |
value
The BoundsIntField value.
Declaration
[CreateProperty]
[UxmlAttribute]
public BoundsInt value { get; set; }
Property Value
| Type | Description |
|---|---|
| BoundsInt |
Methods
GetSizeUssClassName(Size)
Declaration
public static string GetSizeUssClassName(Size enumValue)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | enumValue |
Returns
| Type | Description |
|---|---|
| string |
SetValueWithoutNotify(BoundsInt)
Sets the BoundsIntField value without notifying any change event listeners.
Declaration
public void SetValueWithoutNotify(BoundsInt newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| BoundsInt | newValue | The new value to set. |