public static decimal ReadDecimalConverter(this NetworkReader reader) { var converter = new UIntDecimal { longValue1 = reader.ReadUInt64(), longValue2 = reader.ReadUInt64() }; return converter.decimalValue; }
public static void WriteDecimalConverter(this NetworkWriter writer, decimal value) { // the only way to read it without allocations is to both read and // write it with the FloatConverter (which is not binary compatible // to writer.Write(decimal), hence why we use it here too) var converter = new UIntDecimal { decimalValue = value }; writer.WriteUInt64(converter.longValue1); writer.WriteUInt64(converter.longValue2); }