Serialization.

Serialization.ObjectReference Class

Summary

[Editor-Only] Directly serializing an UnityEngine.Object reference doesn't always work (such as with scene objects when entering Play Mode), so this class also serializes their instance ID and uses that if the direct reference fails.
graph BT Type-->Base0["Object"] Type["Serialization.ObjectReference"] class Type type-node

Syntax

[Serializable]
public class Serialization.ObjectReference

Attributes

Type Description
SerializableAttribute

Constructors

Name Summary
ObjectReference(Object) Creates a new InspectorGadgets.Editor.Serialization.ObjectReference which wraps the specified UnityEngine.Object.

Properties

Name Value Summary
InstanceID int
The UnityEngine.Object.GetInstanceID.
Object Object
The referenced UnityEditor.SerializedObject.

Methods

Name Value Summary
AreSameObjects(Serialization.ObjectReference[], Object[]) bool
Indicates whether both arrays refer to the same set of objects.
static
Convert(Object[]) Serialization.ObjectReference[]
Creates a new array of InspectorGadgets.Editor.Serialization.ObjectReferences representing the `objects`.
static
Convert(Serialization.ObjectReference[]) Object[]
Creates a new array of UnityEngine.Objects containing the target InspectorGadgets.Editor.Serialization.ObjectReference.Object of each of the `references`.
static
ToString() string
Returns a string describing this object.

Operators

Name Value Summary
implicit operator Object(Serialization.ObjectReference) Object
implicit operator Serialization.ObjectReference(Object) Serialization.ObjectReference

Extension Methods

Name Value Summary
IsValid() bool
Returns true if the `reference` and InspectorGadgets.Editor.Serialization.ObjectReference.Object are not null.