Version 3.3.1.2

UnityReferenceResolver class

Namespace: Sirenix.Serialization
Assembly: Sirenix.Serialization
public sealed class UnityReferenceResolver : IExternalIndexReferenceResolver, ICacheNotificationReceiver
Resolves external index references to Unity objects.
Inheritance
  • System.Object
  • UnityReferenceResolver
See Also
  • Sirenix.Serialization.IExternalIndexReferenceResolver
  • Sirenix.Serialization.Utilities.ICacheNotificationReceiver

Constructors

UnityReferenceResolver()
Initializes a new instance of the UnityReferenceResolver class.
public UnityReferenceResolver()
UnityReferenceResolver(List<Object>)
Initializes a new instance of the UnityReferenceResolver class with a list of Unity objects.
public UnityReferenceResolver(List<Object> referencedUnityObjects)
Parameters
System.Collections.Generic.List<UnityEngine.Object> referencedUnityObjects

The referenced Unity objects.

Methods

CanReference(Object, out Int32)
Determines whether the specified value can be referenced externally via this resolver.
public bool CanReference(object value, out int index)
Parameters
System.Object value

The value to reference.

System.Int32 index

The index of the resolved value, if it can be referenced.

Returns
System.Boolean

true if the reference can be resolved, otherwise false.

GetReferencedUnityObjects()
Gets the currently referenced Unity objects.
public List<Object> GetReferencedUnityObjects()
Returns
System.Collections.Generic.List<UnityEngine.Object>

A list of the currently referenced Unity objects.

Reset()
Resets this instance.
public void Reset()
SetReferencedUnityObjects(List<Object>)
Sets the referenced Unity objects of the resolver to a given list, or a new list if the value is null.
public void SetReferencedUnityObjects(List<Object> referencedUnityObjects)
Parameters
System.Collections.Generic.List<UnityEngine.Object> referencedUnityObjects

The referenced Unity objects to set, or null if a new list is required.

TryResolveReference(Int32, out Object)
Tries to resolve the given reference index to a reference value.
public bool TryResolveReference(int index, out object value)
Parameters
System.Int32 index

The index to resolve.

System.Object value

The resolved value.

Returns
System.Boolean

true if the index could be resolved to a value, otherwise false.