fix: Adding INetworkSerializeByMemcpy where recommended for network serialization [MTT-5912] by fernando-cortez · Pull Request #822 · Unity-Technologies/com.unity.multiplayer.samples.coop
Description
INetworkSerializeByMemcpy interface is recommended usage for network messages containing value types. It for allows some bandwidth optimization techniques (byte packing) that are otherwise unavailable.
It is not recommended in places where object types are serialized, nor when FixedStrings are used.
INetworkSerializeByMemcpy [when used with FixedStrings] struct is not recommended because it will lose the bandwidth optimization - an empty FixedString128Bytes serialized normally or through INetworkSerializable will use 4 bytes of bandwidth, but inside an INetworkSerializeByMemcpy, that same empty value would consume 132 bytes of bandwidth.
Issue Number(s)
Contribution checklist
- Tests have been added for boss room and/or utilities pack
- Release notes have been added to the project changelog file and/or package changelog file
- Pull request has a meaningful description of its purpose
- All commits are accompanied by meaningful commit messages
- JIRA ticket ID is in the PR title or at least one commit message
- Include the ticket ID number within the body message of the PR to create a hyperlink
- An Index entry has been added in readme.md if applicable