Skip to content

Commit d7534e5

Browse files
fix: UnifiedBootstrap creates a duplicate LocalWorld on 7000.0.0a12+ (#4243)
* fix: UnifiedBootstrap no longer creates a duplicate LocalWorld on 7000.0.0a12+ From 7000.0.0a12 Entities creates the default world and all of its systems before it calls the custom bootstrap. UnifiedBootstrap still called CreateLocalWorld("LocalWorld") when no NetworkManager was initializing, so a second world ran every default system. Systems that hand state to NetworkManager (for example a system that registers itself with the transform state manager) could end up bound to the empty LocalWorld instead of the world that holds the scene's entities. Under UNITY_ENTITIES_WORLD_LIFETIME_CHANGES (the same version define N4E uses) the bootstrap now uses the existing default world. * Update CHANGELOG * update Bumping NGO version. Updating validation exceptions file with the bumped version.
1 parent 19503c9 commit d7534e5

5 files changed

Lines changed: 15 additions & 3 deletions

File tree

‎com.unity.netcode.gameobjects/CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
1818

1919
### Fixed
2020

21+
- Issue where the unified bootstrap created a second world that ran a duplicate of every default system next to the default world. (#4243)
2122
- Ensured a useful and human readable error is logged when a NetworkVariable is trying to serialize a private or protected type. (#4239)
2223
- Issue where `NetworkAnimator` logged an error for a trigger-conditioned transition into an Exit node, and a client that joined during that transition, or during one into a sub-state machine, did not synchronize with it. Transitions that pass through Exit, Entry or sub-state machine nodes now resolve to the state they reach, and a late-joining client cross-fades from the matching originating state when several states transition into the same destination. (#4238)
2324
- Ensured all callbacks are wrapped with exception handling to avoid silent errors. (#4161)

‎com.unity.netcode.gameobjects/Runtime/Components/Helpers/UnifiedBootstrap.cs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,13 @@ public override bool Initialize(string defaultWorldName)
112112
}
113113
else
114114
{
115+
#if UNITY_ENTITIES_WORLD_LIFETIME_CHANGES
116+
// Entities creates the default world and all its systems before calling the bootstrap, so a local world
117+
// here would run a second copy of every system against a world that holds none of the scene's entities.
118+
LastCreatedWorld = World.DefaultGameObjectInjectionWorld;
119+
#else
115120
LastCreatedWorld = CreateLocalWorld("LocalWorld");
121+
#endif
116122
}
117123

118124
// Always wrap events that can invoke user script in a try-catch to assure any

‎com.unity.netcode.gameobjects/Runtime/Unity.Netcode.Runtime.asmdef‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@
101101
"expression": "0.1.0",
102102
"define": "UNITY_MULTIPLAYER_PLAYMODE"
103103
},
104+
{
105+
"name": "Unity",
106+
"expression": "7000.0.0a12",
107+
"define": "UNITY_ENTITIES_WORLD_LIFETIME_CHANGES"
108+
},
104109
{
105110
"name": "Unity",
106111
"expression": "[6000.4.0b5,6000.5.0a1)",

‎com.unity.netcode.gameobjects/ValidationExceptions.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
{
44
"ValidationTest": "NDA Keyword Validation",
55
"ExceptionMessage": "#if UNITY_7000_0_OR_NEWER",
6-
"PackageVersion": "3.2.1"
6+
"PackageVersion": "3.2.2"
77
},
88
{
99
"ValidationTest": "NDA Keyword Validation",
1010
"ExceptionMessage": "File 'Editor/InScenePlacedProcessor.cs' contains deny-listed keyword pattern '(?<!BestPracticeUnderstandingPerformanceIn)unity[ _]*7' It must not be published",
11-
"PackageVersion": "3.2.1"
11+
"PackageVersion": "3.2.2"
1212
}
1313
],
1414
"WarningExceptions": []

‎com.unity.netcode.gameobjects/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "com.unity.netcode.gameobjects",
33
"displayName": "Netcode for GameObjects",
44
"description": "Netcode for GameObjects is a high-level netcode SDK that provides networking capabilities to GameObject/MonoBehaviour workflows within Unity and sits on top of underlying transport layer.",
5-
"version": "3.2.1",
5+
"version": "3.2.2",
66
"unity": "6000.7",
77
"unityRelease": "0b8",
88
"dependencies": {

0 commit comments

Comments
 (0)