Exemplo n.º 1
0
 /// <summary>
 /// Serializes the given value, using the given writer.
 /// </summary>
 /// <typeparam name="T">The type of the value to serialize.</typeparam>
 /// <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 SerializeValue <T>(T value, IDataWriter writer, out List <UnityEngine.Object> unityObjects)
 {
     using (var unityResolver = Cache <UnityReferenceResolver> .Claim())
     {
         writer.Context.IndexReferenceResolver = unityResolver.Value;
         Serializer.Get <T>().WriteValue(value, writer);
         writer.FlushToStream();
         unityObjects = unityResolver.Value.GetReferencedUnityObjects();
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Serializes the given value using the given writer.
 /// </summary>
 /// <typeparam name="T">The type of the value to serialize.</typeparam>
 /// <param name="value">The value to serialize.</param>
 /// <param name="writer">The writer to use.</param>
 public static void SerializeValue <T>(T value, IDataWriter writer)
 {
     Serializer.Get <T>().WriteValue(value, writer);
     writer.FlushToStream();
 }
Exemplo n.º 3
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();
 }