Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


TryGetValueFromBag<T>(IUxmlAttributes, CreationContext, Func<string, T, T>, T, ref T)

Tries to get the attribute value from the attribute bag.
Read time 1 minuteLast updated 4 days ago

Definition

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

protected bool TryGetValueFromBag<T>(IUxmlAttributes bag, CreationContext cc, Func<string, T, T> converterFunc, T defaultValue, ref T value)

Parameters

A bag contains 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.

value

T
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

boolTrue if the value is found, false otherwise.