/// <summary>
 /// Кладет структуру в Writer(обертка над массивом байт)
 /// Только для структур(MarshalAs for pointers)
 /// </summary>
 public static bool PutInWriter(this LiteNetLib.Utils.NetDataWriter writer, object obj, bool acceptOffset = true, bool reset = false)
 {
     try
     {
         if (reset)
         {
             writer.Reset();
         }
         int size = Marshal.SizeOf(obj.GetType());
         writer.ResizeIfNeed(writer.Length + size);
         obj.CopyTo(writer.Data, writer.Length);
         if (acceptOffset)
         {
             writer.AddOffset(size);
         }
         return(true);
     }
     catch (Exception e) { Debug.LogError("PutInWriter is bad=" + e); }
     return(false);
 }