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

fix: Compatibility fixes for UTP 2.X #2786

Merged
merged 6 commits into from
Dec 8, 2023

Conversation

simon-lemay-unity
Copy link
Contributor

Miscellaneous fixes to make NGO and its test project compatible with UTP 2.X:

  • Two instances of an implicit conversion from NativeList to NativeArray. That's deprecated in Collections 2.X and we now have to use the explicit AsArray method.
  • Two sets of tests were using the debug simulator of UnityTransport, but that's not available anymore with UTP 2.X, where using the simulator in the tools package is now preferred. I'm not sure exactly how to write these tests to be compatible with both versions of UTP, so for now I opted to disable them if UTP 2.X is installed. Not ideal, but at least it allows compilation of the test project when using UTP 2.X.
  • Not related to UTP 2.X at all, but there was a missing .meta file, so I'm adding that at the same time.

Changelog

N/A

Testing and Documentation

  • No tests have been added, quite the contrary in fact.
  • No documentation changes or additions were necessary.

@@ -63,7 +63,7 @@ public unsafe void Handle(ref NetworkContext context)
using (WrappedMessage.WriteBuffer)
{
WrappedMessage.WriteBuffer.WriteBytesSafe(WrappedMessage.ReadBuffer.GetUnsafePtr(), WrappedMessage.ReadBuffer.Length);
networkManager.MessageManager.SendMessage(ref WrappedMessage, Delivery, nonServerIds);
networkManager.MessageManager.SendMessage(ref WrappedMessage, Delivery, nonServerIds.AsArray());
Copy link
Collaborator

Choose a reason for hiding this comment

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

I actually think NetworkMessageManager.SendMessage should be adjusted to support a NativeList overload rather than changing this to pass AsArray(). It could basically be a direct copy-paste of the NativeArray overload (which is only one line anyway).

@simon-lemay-unity simon-lemay-unity enabled auto-merge (squash) December 7, 2023 21:50
@simon-lemay-unity simon-lemay-unity merged commit 01e8738 into develop Dec 8, 2023
1 check passed
@simon-lemay-unity simon-lemay-unity deleted the fix/collections-2.x-compatibility branch December 8, 2023 17:50
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