Skip to content

chore: asmdef guid references - #4152

Open
NoelStephensUnity wants to merge 3 commits into
develop-3.x.xfrom
chore/asmdef-guid-references
Open

chore: asmdef guid references#4152
NoelStephensUnity wants to merge 3 commits into
develop-3.x.xfrom
chore/asmdef-guid-references

Conversation

@NoelStephensUnity

@NoelStephensUnity NoelStephensUnity commented Sep 6, 2026

Copy link
Copy Markdown
Member

Purpose of this PR

Validating the GUID assembly references for N4E as opposed to the assembly namespaces themselves.
Renames NetworkMetrics (internal to SDK) to ToolsNetworkMetrics.
1st pass: run through /ci command to validate the GUIDs.
2nd pass: (If they are correct) Mark for review and merge.

Jira ticket

MTT-15570

Changelog

NA

Documentation

  • No documentation changes or additions were necessary.

Testing & QA (How your changes can be verified during release Playtest)

Functional Testing

Manual testing :

  • Manual testing done

Automated tests:

  • Covered by existing automated tests
  • Covered by new automated tests

Does the change require QA team to:

  • Review automated tests?
  • Execute manual tests?
  • Provide feedback about the PR?

If any boxes above are checked the QA team will be automatically added as a PR reviewer.

Up-port

N/A

Backports

N/A

Three asmdefs named "Unity.NetCode" and "Unity.NetCode.Editor" as strings. Unity silently drops an
asmdef reference it cannot resolve, so renaming either assembly would make every UNIFIED_NETCODE code
path fail to compile with nothing pointing at the cause. A GUID reference resolves to whichever
asmdef asset carries that GUID regardless of the name inside it, which is how NGO's own editor
assembly rename stayed transparent to projects referencing it.

The GUIDs are read from the installed package's .asmdef.meta files, not derived:
  Unity.NetCode         953adc2a6b8b4e3c8df5b728bcd546e9
  Unity.NetCode.Editor  eb8cf780bf058694ebf7ec5cf5b8cfa3

Unity.Entities is left by name. It is not the assembly at risk of a rename, and converting it would
add surface that cannot be checked here for no benefit.

Not verified locally: confirming a GUID reference resolves needs an editor with both packages
installed. Worth an import in a project that has Netcode for Entities before this is relied on - if a
GUID is wrong the reference drops silently, which is the failure this is meant to prevent.
The last of the three type names NGO and Netcode for Entities share. This one is internal, so no user
sees it and it is not a compile error either way: a source-declared type beats an imported one, so
NGO's own assembly would take its own and warn CS0436. But once the two namespaces converge the
warning appears in our build log for a name nobody can act on from outside, and "Unity.Netcode holds
no name that collides" is a simpler thing to be able to say than "two of the three".

ToolsNetworkMetrics keeps the suffix, so it still reads as a pair with its sibling
NullNetworkMetrics - the two INetworkMetrics implementations, one behind MULTIPLAYER_TOOLS and one
not.

Five sites in two files: the declaration, both constructors, the profiler marker and the single
construction site. Everything else that reads NetworkMetrics is a property of that name on
NetworkManager, NetworkMetricsManager or NetworkTransport, all typed INetworkMetrics and untouched.

The profiler marker keeps its old string rather than following the rename. It is what shows up in the
Profiler, and an internal rename is not a reason to move it, so nameof gives way to the literal with
a comment saying why.

Verified as far as this machine allows: runtime, editor and runtime tests all compile clean, which
covers the #else branch. The renamed class is entirely inside #if MULTIPLAYER_TOOLS and the harness
has no Unity.Multiplayer.Tools references, so that branch cannot be built here. A parse pass over the
file with the define on reports only CS0246/CS0234 for the tools types and no structural error, which
is what a class and constructor disagreeing on a name would produce. The define-on path still wants a
real editor build before this is trusted.
@NoelStephensUnity

Copy link
Copy Markdown
Member Author

/ci unified

@NoelStephensUnity
NoelStephensUnity marked this pull request as ready for review September 7, 2026 03:30
@NoelStephensUnity
NoelStephensUnity requested review from a team and EmandM as code owners September 7, 2026 03:30

@u-pr u-pr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Harness Review

Ship it

The metrics implementation rename is consistently guarded and its interface-facing consumers remain unchanged; the assembly references were updated only where the optional unified Netcode integration is declared. I examined the concrete-type usages, conditional compilation paths, profiler marker, and the affected assembly definitions and project manifests.

Reviewed commit 46223c5

🤖 Helpful? 👍/👎

@codecov-github-com

codecov-github-com Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

@@                Coverage Diff                @@
##           develop-3.x.x    #4152      +/-   ##
=================================================
+ Coverage          78.01%   78.25%   +0.24%     
=================================================
  Files                153      154       +1     
  Lines              26260    26543     +283     
=================================================
+ Hits               20486    20771     +285     
+ Misses              5774     5772       -2     
Flag Coverage Δ
NGOv2_project_testproject_ubuntu_pinnedTrunk 77.79% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...meobjects/Runtime/Metrics/NetworkMetricsManager.cs 100.00% <100.00%> (ø)
...gameobjects/Runtime/Metrics/ToolsNetworkMetrics.cs 84.50% <100.00%> (ø)

... and 3 files with indirect coverage changes

Components Coverage Δ
com.unity.netcode.gameobjects 78.25% <97.01%> (+0.24%) ⬆️

ℹ️ Need help interpreting these results?

@michalChrobot michalChrobot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, I don't fully understand why we should use GUID instead of usual naming in the asmdef but we can clarify on call

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.

2 participants