Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why package a layer when ProtoInclude is used for serialization #1117

Open
lin12058 opened this issue Dec 26, 2023 · 0 comments
Open

Why package a layer when ProtoInclude is used for serialization #1117

lin12058 opened this issue Dec 26, 2023 · 0 comments

Comments

@lin12058
Copy link

lin12058 commented Dec 26, 2023

As you can see, I only have one baseclass
As I serialized it, I cannot understand why it is necessary to wrap a layer of completely meaningless data during serialization
Because I have already specified my baseclass in the code
The first character is always 0A, followed by the length of the packaging
And it is completely incompatible with Google's protobuf.js

image

List<GameObj> arr = [
    new Frame(){id=1,x=4},
    new Control(){id=1,processCount=4},
];
ProtoBuf.Serializer.Deserialize<GameObj>[] // This way, there is packaging
ProtoBuf.Serializer.Deserialize<Control>[] //This way, there is not packaging

The arr here is GameObj, so it will be packaged. If it is written separately, it will not be. However, since you have specified the baseclass, there is no need to package the two bytes of 0A+(length+2) that are not used in this layer

So is there any way to remove it?

笔记
双语对照

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant