Example #1
0
 /// <summary>
 /// Serializes the given value, using the given writer.
 /// </summary>
 /// <param name="value">The value to serialize.</param>
 /// <param name="writer">The writer to use.</param>
 /// <param name="unityObjects">A list of the Unity objects which were referenced during serialization.</param>
 public static void SerializeValueWeak(object value, IDataWriter writer, out List <UnityEngine.Object> unityObjects)
 {
     using (var unityResolver = Cache <UnityReferenceResolver> .Claim())
     {
         writer.Context.IndexReferenceResolver = unityResolver.Value;
         Serializer.GetForValue(value).WriteValueWeak(value, writer);
         writer.FlushToStream();
         unityObjects = unityResolver.Value.GetReferencedUnityObjects();
     }
 }
Example #2
0
 /// <summary>
 /// Serializes the given value using the given writer.
 /// </summary>
 /// <param name="value">The value to serialize.</param>
 /// <param name="writer">The writer to use.</param>
 public static void SerializeValueWeak(object value, IDataWriter writer)
 {
     Serializer.GetForValue(value).WriteValueWeak(value, writer);
     writer.FlushToStream();
 }