Description
The Create
method in the SerializedProperty
class is used to create a new serialized property with a specified title, getter, setter, and attributes. This method is marked as obsolete, and it is recommended to use TypeLibrary.CreateProperty
instead.
Usage
To use the Create
method, you need to provide the following parameters:
title
: A string
representing the title of the property.
get
: A Func<T>
delegate that defines the getter for the property.
set
: An Action<T>
delegate that defines the setter for the property.
attributes
: An array of Attribute
objects that define additional metadata for the property.
Note that this method is static and should be called on the SerializedProperty
class itself.
Example
// Example usage of the Create method
// This example is for illustrative purposes only, as the method is obsolete.
string title = "Example Property";
Func<int> getter = () => 42;
Action<int> setter = (value) => { /* set value logic */ };
Attribute[] attributes = new Attribute[] { new ObsoleteAttribute("Use TypeLibrary.CreateProperty instead.") };
SerializedProperty property = SerializedProperty.Create(title, getter, setter, attributes);