Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


GetValueFromBag<T>(IUxmlAttributes, CreationContext, Func<string, T, T>, T)

Get the attribute value from the attribute bag.
Read time 1 minuteLast updated 11 days ago

Definition

Warning
Deprecated. UxmlTraits system is deprecated and will be removed. Use UxmlElementAttribute instead.
protected T GetValueFromBag<T>(IUxmlAttributes bag, CreationContext cc, Func<string, T, T> converterFunc, T defaultValue)

Parameters

A bag containing attributes and their values as strings.

The context in which the values are retrieved.

converterFunc

A function to convert a string value to type T.

defaultValue

T
The value to return if the attribute is not found in the bag.

Returns

Type

Description

TThe attribute value from the bag, or defaultValue if the attribute is not found.

Remarks

The attribute is looked up using _name. If it is not found, each _obsoleteNames is tried in turn, from first to last.