Select your preferred scripting language. All code snippets will be displayed in this language.
class in UnityEditor
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.
CloseSerializedObject and SerializedProperty are classes for editing properties on objects in a completely generic way that automatically handles undo and styling UI for prefabs.
SerializedObject is used in conjunction with SerializedProperty and Editor classes.
See Also: SerializedProperty class, Editor class.
#pragma strict public class MyObject extends ScriptableObject { public var myInt: int = 42; } public class SerializedProperty extends MonoBehaviour { function Start() { var obj: var = ScriptableObject.CreateInstance.<MyObject>(); var serializedObject: var = new UnityEditor.SerializedObject(obj); var serializedPropertyMyInt: var = serializedObject.FindProperty("myInt"); Debug.Log("myInt " + serializedPropertyMyInt.intValue); } }
using UnityEngine;
public class MyObject : ScriptableObject { public int myInt = 42; }
public class SerializedProperty : MonoBehaviour { void Start () { var obj = ScriptableObject.CreateInstance<MyObject>(); var serializedObject = new UnityEditor.SerializedObject(obj);
var serializedPropertyMyInt = serializedObject.FindProperty("myInt");
Debug.Log("myInt " + serializedPropertyMyInt.intValue); } }
isEditingMultipleObjects | Does the serialized object represents multiple objects due to multi-object editing? (Read Only) |
targetObject | The inspected object (Read Only). |
targetObjects | The inspected objects (Read Only). |
SerializedObject | Create SerializedObject for inspected object. |
ApplyModifiedProperties | Apply property modifications. |
CopyFromSerializedProperty | Copies a value from a SerializedProperty to the same serialized property on this serialized object. |
FindProperty | Find serialized property by name. |
GetIterator | Get the first serialized property. |
SetIsDifferentCacheDirty | Update hasMultipleDifferentValues cache on the next /Update()/ call. |
Update | Update serialized object's representation. |
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. |