WriteValuePacked Bug

Open
#2,598 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
csharp
Domain
networking

Research direction

Start with the WriteValuePacked API and reproduce the float case using the test runner. Inspect the float-to-uint conversion and packed serialization behavior; done means the reason for the current byte count is established and a reproducible test verifies the expected serialized size.

Written by the indexing model from the issue text.

Description

priority:low Tracking type:support
Description

Hello,I find when use the WriteValuePacked api to pack a float value, it will convert the float to uint.Due to the storage format of the float the convert value will bigger than 1 << 29,which can lead to the result of using 5 bytes to serialize the float,so can you tell me the reason why we convert the float to uint.

Reproduce Steps

Use the test runner to pack the float number.

Actual Outcome

Lead to the result of using 5 bytes to serialize the float.

Expected Outcome

Use less than 4 bytes to serialize the float.

Screenshots

image

Dominant language
C#
Stars
2.3k
Forks
461
Avg merge
3d 16h
Merged PRs (30d)
20

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Unity-Technologies/com.unity.netcode.gameobjects

All issues in Unity-Technologies/com.unity.netcode.gameobjects

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.