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 13 days ago

Definition

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 UxmlAttributeDescription.name. If it is not found, each UxmlAttributeDescription.obsoleteNames is tried in turn, from first to last.