public void Serialize(UABPacker packer, UABField field, ref object value, List <ISerializer> serializers)
        {
            field.serializatorId = this.GetId();
            field.fieldType      = FieldType.BinaryType;
            var sprite = (value as Sprite);

            if (packer == null)
            {
                                #if UNITY_EDITOR
                var oldReadable = TextureSerializerHelper.PrepareForEncode(sprite.texture);
                var bytes       = sprite.texture.EncodeToPNG();
                TextureSerializerHelper.CompleteEncoding(sprite.texture, oldReadable);
                field.data = System.Convert.ToBase64String(bytes);
                                #endif
            }
            else
            {
                var data = new Data();
                data.spriteRect          = sprite.rect;
                data.spritePivot         = sprite.pivot;
                data.spritePixelsPerUnit = sprite.pixelsPerUnit;
                data.spriteExtrude       = 0u;
                data.spriteMeshType      = SpriteMeshType.FullRect;
                data.spriteBorder        = sprite.border;
                field.fields             = packer.Serialize(data, serializers);
            }
        }
 public void Serialize(UABPacker packer, UABField field, ref object value, List <ISerializer> serializers)
 {
     field.serializatorId = this.GetId();
     field.fieldType      = FieldType.BinaryType;
     if (packer == null)
     {
                         #if UNITY_EDITOR
         var oldReadable = TextureSerializerHelper.PrepareForEncode(value as Texture);
         var texture     = (value as Texture2D);
         var bytes       = texture.EncodeToPNG();
         TextureSerializerHelper.CompleteEncoding(texture, oldReadable);
         field.data = System.Convert.ToBase64String(bytes);
                         #endif
     }
     else
     {
         var data = new Data();
         field.fields = packer.Serialize(data, serializers);
     }
 }