本文整理匯總了C#中UnityEditor.SerializedProperty.GetProvider方法的典型用法代碼示例。如果您正苦於以下問題:C# SerializedProperty.GetProvider方法的具體用法?C# SerializedProperty.GetProvider怎麽用?C# SerializedProperty.GetProvider使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UnityEditor.SerializedProperty
的用法示例。
在下文中一共展示了SerializedProperty.GetProvider方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: RegisterArrayProperty
/// <summary>
/// Registers the array property and its size property.
/// </summary>
/// <param name="arrayProperty">Array property.</param>
/// <param name="getter">Getter.</param>
/// <param name="setter">Setter.</param>
/// <param name="propertyType">Property type.</param>
private static void RegisterArrayProperty(
SerializedProperty arrayProperty,
System.Func<object, object> getter,
System.Action<object, object> setter,
System.Type propertyType
)
{
HashableSerializedProperty hashableArrayProperty =
new HashableSerializedProperty(arrayProperty.propertyPath, arrayProperty.serializedObject.targetObject);
HashableSerializedProperty hashableArraySizeProperty = new HashableSerializedProperty(
arrayProperty.propertyPath + ".Array.size", arrayProperty.serializedObject.targetObject
);
RegisterPropertyIfNeeded(hashableArrayProperty, hashableArrayProperty, getter, setter, propertyType);
RegisterPropertyIfNeeded(hashableArraySizeProperty, hashableArrayProperty, getter, setter, propertyType);
FieldInfo field;
arrayProperty.GetProvider(out field);
s_ValueCache[hashableArrayProperty] = field.FieldType.IsArray ?
System.Array.CreateInstance(field.FieldType.GetElementType(), 0) :
System.Activator.CreateInstance(field.FieldType);
s_ValueCache[hashableArraySizeProperty] = 0;
}