Skip to content

feat: Native container serialization #2375

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

Merged
merged 17 commits into from
May 24, 2023

Conversation

ShadauxCat
Copy link
Collaborator

Support for native containers in FastBufferReader/Writer, BufferSerializer, NetworkVariable, and RPCs.

Changelog

  • Added: Added support for native containers in FastBufferReader/Writer, BufferSerializer, NetworkVariable, and RPCs.

Testing and Documentation

  • Includes unit tests.
  • Includes integration tests.
  • Includes documentation for previously-undocumented public API entry points.

@ShadauxCat ShadauxCat requested a review from a team as a code owner January 9, 2023 23:36
@ShadauxCat ShadauxCat changed the title Feat: Native container serialization feat: Native container serialization Jan 10, 2023
Comment on lines +2140 to +2147
// This simplifies things - easier to call __createNativeList() and have the implementation in C#
// than to try to actually construct a NativeList in IL. This is also more future-proof.

// Unlike other types, NativeList<> calls ReadValueSafeInPlace instead of ReadValueSafe.
// FastBufferReader doesn't support a non-in-place deserializer for NativeList in order to
// avoid users using it without realizing the allocation overhead that would cost. In-place
// is more efficient when an existing value exists, and when it doesn't, it's easy to create one,
// which is what we do here.
Copy link
Contributor

Choose a reason for hiding this comment

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

agreed — also thanks for the comment.

Copy link
Collaborator

@NoelStephensUnity NoelStephensUnity left a comment

Choose a reason for hiding this comment

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

LGTM!

@ShadauxCat ShadauxCat marked this pull request as draft March 3, 2023 18:05
…native containers and managed types) that may be changed without setting the dirty flag.
@ShadauxCat ShadauxCat marked this pull request as ready for review March 7, 2023 20:46
…ion' into feat/native_container_serialization
# Conflicts:
#	com.unity.netcode.gameobjects/CHANGELOG.md
#	com.unity.netcode.gameobjects/Tests/Editor/Serialization/BaseFastBufferReaderWriterTest.cs
#	com.unity.netcode.gameobjects/Tests/Editor/Serialization/FastBufferReaderTests.cs
#	com.unity.netcode.gameobjects/Tests/Editor/Serialization/FastBufferWriterTests.cs
#	com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariableTests.cs
#	com.unity.netcode.gameobjects/Tests/Runtime/RpcTests.cs
…Also I forgot to check in the merge before starting this work, so...

Merge branch 'develop' into feat/native_container_serialization

# Conflicts:
#	com.unity.netcode.gameobjects/Editor/CodeGen/NetworkBehaviourILPP.cs
#	com.unity.netcode.gameobjects/Editor/CodeGen/RuntimeAccessModifiersILPP.cs
Copy link
Collaborator

@NoelStephensUnity NoelStephensUnity left a comment

Choose a reason for hiding this comment

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

Looks good to me (a second time!) 😸

@ShadauxCat ShadauxCat enabled auto-merge (squash) May 24, 2023 21:28
@ShadauxCat ShadauxCat merged commit 1c74129 into develop May 24, 2023
@ShadauxCat ShadauxCat deleted the feat/native_container_serialization branch May 24, 2023 22:05
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

Successfully merging this pull request may close these issues.

4 participants