使用protobuf3工具自动生成的类,在封装数据的时候会把0值自动舍弃???
mInfo = new Info
{
Id = hit.transform.gameObject.GetInstanceID(),
Type = InfoType.Move,
Pos = new V3 { X = pos.x, Y = pos.y, Z = pos.z },
Rot = new V3 { X = rot.x, Y = rot.y, Z = rot.z }
};
Debug.Log(mInfo);
其中的Info和V3是自动生成的代码
proto文件如下
syntax = "proto3";
message Info
{
int32 id=1;
InfoType type=2;
V3 pos=3;
V3 rot=4;
}
message V3
{
float x=1;
float y=2;
float z=3;
}
enum InfoType
{
Move = 0;
LClick = 1;
RClick = 2;
}