WriteValuePacked Bug

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

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

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

调研方向

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

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

描述

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

主要语言
C#
星标
2.3k
派生
465
平均合并
3 天 12 小时
30 天内合并 PR
39

环境准备

从这里开始

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

Unity-Technologies/com.unity.netcode.gameobjects 的其他 Issue

查看 Unity-Technologies/com.unity.netcode.gameobjects 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

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