Skip to content

PooledBitReader.ReadBits(16) only reads 8 bits #378

@figs999

Description

@figs999

Describe the bug
When 16 is passed as the quantity of bits to read to PooledBitReader.ReadBits, the stream only advances 8 bits and only the value of the first 8 bits is returned. This does not appear to be a problem with any value other than 16 for some reason. I am able to read other multiples of 8, 15 bits, 17 bits etc.

I do not know if this is specific to my particular use case of using an Unreliable type data channel and CustomMessagingManager.SendUnnamedMessage;

To Reproduce
Steps to reproduce the behavior:

  1. Send a stream with a 16 bit value written to it with PooledBitWriter,WriteBits({val},16); via CustomMessagingManager.SendUnnamedMessage over an unreliable type channel
  2. On receiving client, call ReadBits(16) on a PooledBitReader constructed with the received stream via PooledBitReader.Get.
  3. Notice the stream has only advanced 8 bits, and the value returned is only the value of the leading 8 bits of the intended 16-bit value.

Expected behavior
Reading 16 bits from the PooledBitReader should advance the stream 16 bits and return the value represented in those 16 bits.

Environment (please complete the following information):

  • OS: Windows 10
  • Unity Version: 2019.1
  • MLAPI Version: v12.1.6
  • MLAPI Commit: release build

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions