Unity - Scripting API: SerializedProperty

class in UnityEditor

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

SerializedProperty and SerializedObject are classes for editing properties on objects in a completely generic way that automatically handles undo, multi-object editing and Prefab overrides.

SerializedProperty is primarily used to read or change the value of a property. It can also iterate through the properties of an object using Next. Additional resources: SerializedObject class, Editor class.

Public Methods

Method Description
ClearArrayRemove all elements from the array.
CopyReturns a copy of the SerializedProperty iterator in its current state.
CountInPropertyCount visible children of this property, including this property itself.
CountRemainingCount remaining visible properties.
DeleteArrayElementAtIndexDelete the element at the specified index in the array.
DeleteCommandDeletes the array element referenced by the SerializedProperty.
DuplicateCommandDuplicates the array element referenced by the SerializedProperty.
FindPropertyRelativeRetrieves the SerializedProperty at a relative path to the current property.
GetArrayElementAtIndexReturns the element at the specified index in the array.
GetEndPropertyRetrieves the SerializedProperty that defines the end range of this property.
GetEnumeratorRetrieves an iterator for enumerating over the visible child properties of the current property. If the property is an array it will enumerate over the array elements.
GetFixedBufferElementAtIndexReturns the element at the specified index in the fixed buffer.
InsertArrayElementAtIndexInsert an new element at the specified index in the array.
MoveArrayElementMove an array element from srcIndex to dstIndex.
NextMove to next property.
NextVisibleMove to next visible property.
ResetMove to first property of the object.

Static Methods

Method Description
DataEqualsCompares the data for two SerializedProperties. This method ignores paths and SerializedObjects.
EqualContentsSee if contained serialized properties are equal.