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

WriteValuePacked Bug

未关闭
#2,598 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

priority:low Tracking type:support
主要语言
C#
星标
2.3k
派生
461
平均合并
3 天 16 小时
30 天内合并 PR
20

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 WriteValuePacked API 开始,使用 test runner 重现 float 情况。检查 float-to-uint 转换和 packed serialization 的行为;当确定当前字节数的原因,并且有一个可复现的测试验证预期的序列化大小时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
csharp
领域
networking
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。