Commit b7327c9
chore: netcode for entities 7.0.0 as a dependency (#4158)
* chore: netcode for entities 7.0.0 as a dependency, unified api behind a define
N4E becomes a hard dependency at 7.0.0, and com.unity.transport moves to 6.5.0 to match it.
N4E 7.0.0 ships its unified API - GhostObject, GhostBehaviour, GhostField - behind
NETCODE_GAMEOBJECT_BRIDGE_EXPERIMENTAL, which leaves those types internal in the configuration
NGO ships. A public type cannot derive from an internal one, so the unified path can no longer key
off the package being present: the UNIFIED_NETCODE versionDefine is removed from the four assembly
definitions and the symbol is set by the project instead, alongside N4E's own define.
NetworkObjectBridge is internal for the same reason, and UnifiedBootstrap raises an #error when
only one of the two defines is set.
With N4E present the two packages share the Unity.Netcode namespace, which breaks three things
outside the unified gates:
- N4E's Netcode facade type shadows the namespace, so 22 XML doc crefs and one nameof that
qualified with Netcode. stopped resolving.
- N4E declares an INetworkStreamDriverConstructor in the shared root that the enclosing namespace
finds ahead of NGO's, so the one implementation in the editor tests is fully qualified.
- N4E's source generator errors on an assembly that does not reference N4E, so the editor test
assembly now references it.
Multiplayer Services 2.3.1 does not compile against N4E 7.0.0 and no fix is published, so it is
dropped from the test project manifests. Validation moves to trunk, the only editor that has
dropped N4E as a core package and can resolve the 7.0.0 request rather than its bundled 6.7.0.
The unified work is preserved and still compiles with both defines set: the N4E 6.7.0 spellings are
updated, and GhostObject.ApplyPostTransformMatrixScale, which N4E removed in its scale rework, is
reimplemented over the new PostTransformMatrix model. The unified CI job sets the defines itself
and is no longer a PR check.
Also disables the serialization tests that fail under CoreCLR so the package is not ejected from
the editor manifest batch.
Parts of this are taken from #4156.
* chore: fix the standards check for the n4e 7.0.0 dependency
Three things the standards job caught, since it opens the project, runs the formatter with --fix and
then fails on any diff at all:
- The fully qualified INetworkStreamDriverConstructor is simplified by the formatter (IDE0001), so
write it the way the formatter wants. It still resolves to NGO's, since the lookup walks out to
Unity.Netcode.Transports before reaching the shared root.
- N4E 7.0.0 renamed the serialized GlobalNetCodeConfig field to GlobalNetcodeConfig, which the editor
rewrites in the test project's settings asset the first time it loads it.
- validation_editors.minimal is back on a released editor. The standards job opens the project with
it, and trunk rewrites ProjectVersion.txt out from under the cleanliness check. Nothing there needs
N4E present: a released editor bundles 6.7.0 as a built-in package, so the 7.0.0 request is dropped
silently and the project builds with no N4E at all - verified on 6000.7.0a6, which resolves and
compiles clean with N4E absent from packages-lock, PackageCache and ScriptAssemblies alike.
* chore: alias n4e's clashing driver constructor instead of qualifying it
The formatter and the compiler want opposite things here. With N4E present the bare
INetworkStreamDriverConstructor binds to N4E's copy in the shared Unity.Netcode root, which the
enclosing namespace reaches before the using directive, and the class then fails to implement it.
With N4E absent - which is what the standards job's editor resolves - any qualification is redundant
and IDE0001 strips it back off, so the last two attempts each traded one failure for the other.
A file-scope using alias satisfies both. Its target cannot be shortened, since at file scope there is
no enclosing namespace to shorten it against; the use site is a single identifier with no qualified
form; and IDE0005 cannot drop the alias because removing it stops the name resolving at all.
* chore: depend on n4e 6.7.0 and compile the unified path against either version
The 7.0.0 dependency could not be satisfied anywhere. Every editor available today - 6000.7.0a6 and
current trunk alike - lists com.unity.netcode 6.7.0 as mustBeBundled in its manifest, so UPM drops a
7.0.0 request silently: no assemblies, no packages-lock entry, no warning. upm-pvp then fails hard
with "depends on com.unity.netcode, which is not in the lock file", which is what took out Validate
on all three platforms and Package Test on both editors.
Dependency versions are minimums, so asking for 6.7.0 resolves the bundled package today and picks up
7.0.0 by itself once an editor manifest carries it. The transport bump goes back to 2.6.0: 6.5.0 was
never published (the 6.x line is editor-bundled only, latest published is 2.7.4), so it fails
PVP-160-1, which the Validate job explicitly requires - and N4E asks for 6.5.0 itself, so resolution
is unaffected either way. With the dependency resolving everywhere, nothing needs a trunk editor and
validation_editors goes back to what develop had.
Since either version can now be what resolves, the unified path compiles against both, gated on a
UNIFIED_NETCODE_7_0_0 versionDefine keyed to the resolved package version. The 6.7.0 spellings are
aliased to the 7.0.0 names so the use sites read the same either way, except N4E's Netcode class:
inside namespace Unity.Netcode that name binds to the enclosing namespace before any file-scope alias
is considered, so it is aliased as EntitiesNetcode in both. GhostObjectScaleExtensions is 7.0.0-only,
since 6.7.0 still has the method it stands in for.
That also makes the dependency real rather than dropped, which has consequences worth knowing: N4E's
assemblies now build in every project, its ClientServerBootstrap becomes the Entities bootstrap with a
non-zero AutoConnectPort, and it writes a NetcodeConfig into the project when its settings asset does
not resolve one - which is why the GlobalNetCodeConfig field goes back to the 6.7.0 spelling here.
Verified on 6000.7.0a6 against both versions: shipping (unified off), unified against bundled 6.7.0,
and unified against 7.0.0 all compile with zero errors, and the standards check is clean.
* Update com.unity.netcode.gameobjects/CHANGELOG.md
* Updated editor used after 0b1 got released and package dependencies
* Updated testproject and minimalproject to 6000.7.0b1
* Fix for CI issues (will file a ticket)
* correction of previous fix
* re-added services.multiplayer package as compatible version was released
* Disabled tests
* reverted re-adding of services as that version is still not compatible with N4E
---------
Co-authored-by: Michał Chrobot <124174716+michalChrobot@users.noreply.github.com>
Co-authored-by: Michał Chrobot <michal.chrobot@unity3d.com>1 parent 9fda16e commit b7327c9
38 files changed
Lines changed: 219 additions & 121 deletions
File tree
- .yamato
- com.unity.netcode.gameobjects
- Editor
- Runtime
- Components
- Helpers
- Core
- NetworkVariable
- SceneManagement
- Spawning
- Transports/Unified
- Tests
- Editor
- Build
- Transports
- Runtime
- NetworkTransform
- Physics
- Serialization
- TestHelpers
- minimalproject/ProjectSettings
- testproject
- Assets/Tests/Runtime
- Packages
- ProjectSettings
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
| 94 | + | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
| 182 | + | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
| 185 | + | |
186 | 186 | | |
187 | | - | |
188 | | - | |
| 187 | + | |
| 188 | + | |
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
39 | | - | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
3 | 6 | | |
4 | 7 | | |
5 | 8 | | |
| 9 | + | |
6 | 10 | | |
7 | 11 | | |
8 | 12 | | |
| |||
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
24 | 29 | | |
25 | 30 | | |
26 | 31 | | |
| |||
46 | 51 | | |
47 | 52 | | |
48 | 53 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| |||
Lines changed: 47 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
| 5 | + | |
| 6 | + | |
3 | 7 | | |
4 | 8 | | |
5 | 9 | | |
| |||
13 | 17 | | |
14 | 18 | | |
15 | 19 | | |
16 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
17 | 23 | | |
18 | 24 | | |
19 | 25 | | |
| |||
83 | 89 | | |
84 | 90 | | |
85 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
86 | 132 | | |
87 | 133 | | |
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
1 | 4 | | |
2 | 5 | | |
3 | 6 | | |
| 7 | + | |
4 | 8 | | |
| 9 | + | |
5 | 10 | | |
6 | 11 | | |
7 | 12 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
0 commit comments