Skip to content

refactor: Minor cleanups in Unity Transport #3377

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

Conversation

simon-lemay-unity
Copy link
Contributor

@simon-lemay-unity simon-lemay-unity commented Apr 1, 2025

Just a few minor cleanups in Unity Transport:

  • Remove the internal NetworkDriver accessor. There's a public GetNetworkDriver nowadays that can be used for the same purpose.
  • Add a using directive for transport errors which avoids using the full (and long) type name.
  • Remove the internal "state" member. The same information can be gleaned by looking at the driver's state and the value of m_ServerClientId. Plus, the Listening state did not have the same meaning as it does in NGO itself, which could lead to confusion.
  • Simplify ErrorUtilities to avoid the useless constants and only providing strings for errors users can actually do something about. Also moved it to the bottom of the file. The top is too prime real estate for such a minor utility. :P

Changelog

N/A

Testing and Documentation

  • No tests have been added.
  • No documentation changes or additions were necessary.

@simon-lemay-unity simon-lemay-unity requested a review from a team as a code owner April 1, 2025 15:22
@michalChrobot
Copy link
Collaborator

Looks good for me but I would wait for @NoelStephensUnity or @EmandM to approve. Do you think those changes should also be ported to develop branch (NGOv1.X)?

@simon-lemay-unity
Copy link
Contributor Author

I don't think it's worth backporting those changes to version 1.X. They don't really fix anything and they're mostly cleanups I did while working on performance improvements and those will be 2.X-only.

@michalChrobot
Copy link
Collaborator

Okok, makes sense

Copy link
Collaborator

@EmandM EmandM left a comment

Choose a reason for hiding this comment

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

This looks much cleaner. Thank you!

@simon-lemay-unity simon-lemay-unity enabled auto-merge (squash) April 8, 2025 15:46
@simon-lemay-unity simon-lemay-unity merged commit 23412a0 into develop-2.0.0 Apr 8, 2025
27 checks passed
@simon-lemay-unity simon-lemay-unity deleted the refactor/minor-unity-transport-cleanup branch April 8, 2025 20:52
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