Skip to content

Commit

Permalink
Unit不需要用MemoryPack序列化,一般只是帧同步使用,服务端序列化压力不大,用bson即可
Browse files Browse the repository at this point in the history
  • Loading branch information
egametang committed Nov 26, 2023
1 parent 4864709 commit 0b00b6c
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions Unity/Assets/Scripts/Model/Share/Module/Unit/Unit.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
using System.Diagnostics;
using MemoryPack;
using MongoDB.Bson.Serialization.Attributes;
using Unity.Mathematics;

namespace ET
{
[ChildOf(typeof(UnitComponent))]
[DebuggerDisplay("ViewName,nq")]
[MemoryPackable]
public partial class Unit: Entity, IAwake<int>
{
public int ConfigId { get; set; } //配置表id

[MemoryPackInclude]
[BsonElement]
private float3 position; //坐标

[MemoryPackIgnore]
[BsonIgnore]
public float3 Position
{
Expand All @@ -29,19 +25,16 @@ public float3 Position
}
}

[MemoryPackIgnore]
[BsonIgnore]
public float3 Forward
{
get => math.mul(this.Rotation, math.forward());
set => this.Rotation = quaternion.LookRotation(value, math.up());
}

[MemoryPackInclude]
[BsonElement]
private quaternion rotation;

[MemoryPackIgnore]
[BsonIgnore]
public quaternion Rotation
{
Expand Down

1 comment on commit 0b00b6c

@15951836388
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bson和proto的序列化相比,性能都差了很多,能优化为什么不优化呢?

Please sign in to comment.