手册
脚本 API
unity3d.com
Version:
2018.4
2022.1
2021.3
2021.2
2021.1
2020.3
2020.2
2020.1
2019.4
2019.3
2019.2
2019.1
2018.4
2018.3
2018.2
2018.1
2017.4
2017.3
2017.2
2017.1
5.6
手册
脚本 API
语言:
中文
English
中文
日本語
Español
한국어
Русский
脚本 API
Version:
2018.4
2022.1
2021.3
2021.2
2021.1
2020.3
2020.2
2020.1
2019.4
2019.3
2019.2
2019.1
2018.4
2018.3
2018.2
2018.1
2017.4
2017.3
2017.2
2017.1
5.6
Experimental
: this API is experimental and might be changed or removed in the future.
UxmlAttributeDescription
.GetValueFromBag
切换到手册
protected T
GetValueFromBag
(
Experimental.UIElements.IUxmlAttributes
bag
,
Experimental.UIElements.CreationContext
cc
, Func<string,T,T>
converterFunc
, T
defaultValue
);
参数
bag
包含属性及其值(字符串)的属性包。
cc
检索值的上下文。
converterFunc
用于将字符串值转换为类型 T 的函数。
defaultValue
在属性包中找不到该属性时要返回的值。
返回
T
属性包中的属性值,如果未找到该属性,则为 defaultValue。
描述
从属性包中获取属性值。
使用
name
来查找属性。如果找不到属性,则从头到尾依次尝试每个
obsoleteNames
。