SerializedObject Manual     Reference     Scripting  
Scripting > Editor Classes > SerializedObject
SerializedObject

SerializedObject and SerializedProperty are classes for editing properties on objects in a completely generic way that automatically handles undo and styling UI for prefabs.

Note: This is an editor class. To use it you have to place your script in Assets/Editor inside your project folder. Editor classes are in the UnityEditor namespace so for C# scripts you need to add "using UnityEditor;" at the beginning of the script.

SerializedObject is used in conjunction with SerializedProperty and Editor classes.

See Also: SerializedProperty class, Editor class

Variables
targetObject

The inspected object (Read Only).

targetObjects

The inspected objects (Read Only).

isEditingMultipleObjects

Does the serialized object represents multiple objects due to multi-object editing? (Read Only)

Constructors
SerializedObject

Create SerializedObject for inspected object.

Functions
Update

Update serialized object's representation.

SetIsDifferentCacheDirty

Update hasMultipleDifferentValues cache on the next /Update()/ call.

UpdateIfDirtyOrScript

Update serialized object's representation, only if the object has been modified since the last call to Update or if it is a script.

GetIterator

Get the first serialized property.

FindProperty

Find serialized property by name.

ApplyModifiedProperties

Apply property modifications.