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, 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 specify 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
// Note: This method is obsolete. Use TypeLibrary.CreateProperty instead.
string title = "Example Property";
Func<int> getter = () => 42;
Action<int> setter = (value) => { /* set value logic */ };
Attribute[] attributes = new Attribute[] { new ObsoleteAttribute("Example") };
SerializedProperty property = SerializedProperty.Create(title, getter, setter, attributes);