Class UxmlAttributeDescription
Base class for describing an XML attribute.
Namespace: UnityEngine.UIElements
Syntax
public abstract class UxmlAttributeDescription : object
Constructors
UxmlAttributeDescription()
Constructor.
Declaration
protected UxmlAttributeDescription()
Fields
xmlSchemaNamespace
Declaration
protected const string xmlSchemaNamespace = null
Field Value
Type | Description |
---|---|
String |
Properties
defaultValueAsString
The default value for the attribute, as a string.
Declaration
public abstract string defaultValueAsString { get; }
Property Value
Type | Description |
---|---|
String |
name
The attribute name.
Declaration
public string name { get; set; }
Property Value
Type | Description |
---|---|
String |
obsoleteNames
A list of obsolete names for this attribute.
Declaration
public IEnumerable<string> obsoleteNames { get; set; }
Property Value
Type | Description |
---|---|
IEnumerable<String> |
restriction
Restrictions on the possible values of the attribute.
Declaration
public UxmlTypeRestriction restriction { get; set; }
Property Value
Type | Description |
---|---|
UxmlTypeRestriction |
type
Attribute type.
Declaration
public string type { get; protected set; }
Property Value
Type | Description |
---|---|
String |
typeNamespace
Attribute namespace.
Declaration
public string typeNamespace { get; protected set; }
Property Value
Type | Description |
---|---|
String |
use
Whether the attribute is optional, required or prohibited.
Declaration
public UxmlAttributeDescription.Use use { get; set; }
Property Value
Type | Description |
---|---|
UxmlAttributeDescription.Use |
Methods
GetValueFromBag<T>(IUxmlAttributes, CreationContext, Func<String, T, T>, T)
Get the attribute value from the attribute bag.
Declaration
protected T GetValueFromBag<T>(IUxmlAttributes bag, CreationContext cc, Func<string, T, T> converterFunc, T defaultValue)
Parameters
Type | Name | Description |
---|---|---|
IUxmlAttributes | bag | A bag containg attributes and their values as strings. |
CreationContext | cc | The context in which the values are retrieved. |
Func<String, T, T> | converterFunc | A function to convert a string value to type T. |
T | defaultValue | The value to return if the attribute is not found in the bag. |
Returns
Type | Description |
---|---|
T | The attribute value from the bag, or defaultValue if the attribute is not found. |
Type Parameters
Name | Description |
---|---|
T |
Remarks
The attribute is looked up using name. If it is not found, each obsoleteNames is tried in turn, from first to last.
TryGetValueFromBag<T>(IUxmlAttributes, CreationContext, Func<String, T, T>, T, ref T)
Tries to get the attribute value from the attribute bag.
Declaration
protected bool TryGetValueFromBag<T>(IUxmlAttributes bag, CreationContext cc, Func<string, T, T> converterFunc, T defaultValue, ref T value)
Parameters
Type | Name | Description |
---|---|---|
IUxmlAttributes | bag | A bag containg attributes and their values as strings. |
CreationContext | cc | The context in which the values are retrieved. |
Func<String, T, T> | converterFunc | A function to convert a string value to type T. |
T | defaultValue | The value to return if the attribute is not found in the bag. |
T | value | If the attribute could be retrieved, the retrieved value converted by the conversion function or the default value if the retrieved value could not de converted. |
Returns
Type | Description |
---|---|
Boolean | True if the value could be retrieved, false otherwise. |
Type Parameters
Name | Description |
---|---|
T |