Class Vector3IntField
A field component that allows users to input and edit 3D integer vectors with X, Y, and Z coordinates.
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
[UxmlElement]
public class Vector3IntField : BaseVisualElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IContextOverrideElement, IAdditionalDataHolder, IInputElement<Vector3Int>, IValidatableElement<Vector3Int>, ISizeableElement, INotifyValueChanging<Vector3Int>, INotifyValueChanged<Vector3Int>, IFormattable<int>
Remarks
The Vector3IntField is a specialized input component designed for editing 3D integer vectors. It provides three numeric fields for X, Y, and Z coordinates, allowing precise control over 3D integer positions or dimensions.
Each coordinate field supports direct numeric input, validation, and formatting options. The component is particularly useful in scenarios involving grid-based positioning, voxel coordinates, or any 3D integer-based data entry.
The field supports various features including:
- Individual editing of X, Y, and Z coordinates
- Value validation
- Custom formatting
- Different size variants
- Invalid state indication
Examples
Basic usage in UXML: Creating a basic vector field with default values
<ui:Vector3IntField name="position-field" size="M" value="0,0,0" />
Setting up validation and handling value changes: Complex example showing validation and event handling
var vector3IntField = new Vector3IntField();
// Set up validation
vector3IntField.validateValue = (v) =>
v.x >= 0 && v.y >= 0 && v.z >= 0;
// Handle value changes
vector3IntField.RegisterValueChangedCallback(evt => {
Debug.Log($"New value: ");
});
Custom formatting with units: Adding pixel units to the coordinate values
var vector3IntField = new Vector3IntField();
vector3IntField.formatFunction = (value) =>
$"{value}px";
// Set initial value
vector3IntField.value = new Vector3Int(100, 200, 300);
Constructors
Vector3IntField()
Default constructor.
Declaration
public Vector3IntField()
Fields
containerUssClassName
The Vector3Field container styling class.
Declaration
public const string containerUssClassName = "appui-vector3field__container"
Field Value
| Type | Description |
|---|---|
| string |
sizeUssClassName
The Vector3Field size styling class.
Declaration
public const string sizeUssClassName = "appui-vector3field--size-"
Field Value
| Type | Description |
|---|---|
| string |
ussClassName
The Vector3Field main styling class.
Declaration
public const string ussClassName = "appui-vector3field"
Field Value
| Type | Description |
|---|---|
| string |
xFieldUssClassName
The Vector3Field X NumericalField styling class.
Declaration
public const string xFieldUssClassName = "appui-vector3field__x-field"
Field Value
| Type | Description |
|---|---|
| string |
yFieldUssClassName
The Vector3Field Y NumericalField styling class.
Declaration
public const string yFieldUssClassName = "appui-vector3field__y-field"
Field Value
| Type | Description |
|---|---|
| string |
zFieldUssClassName
The Vector3Field Z NumericalField styling class.
Declaration
public const string zFieldUssClassName = "appui-vector3field__z-field"
Field Value
| Type | Description |
|---|---|
| string |
Properties
contentContainer
The content container of the Vector3IntField.
Declaration
public override VisualElement contentContainer { get; }
Property Value
| Type | Description |
|---|---|
| VisualElement |
Overrides
formatFunction
The format function of the element.
Declaration
[CreateProperty]
public FormatFunction<int> formatFunction { get; set; }
Property Value
| Type | Description |
|---|---|
| FormatFunction<int> |
formatString
The format string of the element.
Declaration
[CreateProperty]
[UxmlAttribute]
public string formatString { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
invalid
The invalid state of the Vector3IntField.
Declaration
[CreateProperty]
[UxmlAttribute]
public bool invalid { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
size
The size of the Vector3IntField.
Declaration
[CreateProperty]
[UxmlAttribute]
public Size size { get; set; }
Property Value
| Type | Description |
|---|---|
| Size |
validateValue
The validation function of the Vector3IntField.
Declaration
[CreateProperty]
public Func<Vector3Int, bool> validateValue { get; set; }
Property Value
| Type | Description |
|---|---|
| Func<Vector3Int, bool> |
value
The value of the Vector3IntField.
Declaration
[CreateProperty]
[UxmlAttribute]
public Vector3Int value { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3Int |
Methods
GetSizeUssClassName(Size)
Declaration
public static string GetSizeUssClassName(Size enumValue)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | enumValue |
Returns
| Type | Description |
|---|---|
| string |
SetValueWithoutNotify(Vector3Int)
Sets the value of the Vector3IntField without notifying any listeners.
Declaration
public void SetValueWithoutNotify(Vector3Int newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3Int | newValue | The new value to set. |