Skip to content

Commit 0777b2f

Browse files
Merge branch 'develop-3.x.x' into fix/rpc-pose-test-yield
2 parents 4e3dd0d + 2676f2b commit 0777b2f

28 files changed

Lines changed: 1193 additions & 221 deletions

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,25 @@ Additional documentation and release notes are available at [Multiplayer Documen
1010

1111
### Added
1212

13+
### Changed
14+
15+
### Deprecated
16+
17+
### Removed
18+
19+
### Fixed
20+
21+
- 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)
22+
- Ensured all callbacks are wrapped with exception handling to avoid silent errors. (#4161)
23+
24+
### Security
25+
26+
### Obsolete
27+
28+
## [3.2.0] - 2026-11-03
29+
30+
### Added
31+
1332
- Added Unity CLI commands (`netcode.gameobjects` groups) to set up NetworkManagers and network prefabs, start and stop sessions, inspect clients and spawned objects, spawn, despawn and change ownership, simulate network conditions and sample network traffic. They are available when the project has `com.unity.pipeline` 0.9.0-exp.1 or later. (#4210)
1433
- Added alignment of the Netcode for Entities tick rates with `NetworkConfig.TickRate` when a session carrying `GhostObject` prefabs is started, so `GhostObject` updates land on the same interval as the rest of Netcode for GameObjects. (#4144)
1534
- Added `NetworkConfig.AutoConfigureSnapshotSize`, enabled by default, which sets the Netcode for Entities snapshot packet size to 4096 bytes when a session carrying `GhostObject` prefabs is started. Netcode for Entities defaults to a single MTU, which updates `GhostObject`s well below the tick rate at the instance counts Netcode for GameObjects projects typically run. Disable it to manage the value yourself. (#4144)

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -396,17 +396,21 @@ protected override void OnNetworkPostSpawn()
396396
}
397397

398398
/// <inheritdoc/>
399-
/// <remarks>
400-
/// If overriding this method, it is required that you invoke this base method.
401-
/// </remarks>
399+
// TODO: Not used anymore
402400
public override void OnDestroy()
401+
{
402+
base.OnDestroy();
403+
}
404+
405+
406+
internal override void InternalOnDestroy()
403407
{
404408
if (m_CoroutineObject.IsRunning)
405409
{
406410
StopCoroutine(m_CoroutineObject.Coroutine);
407411
m_CoroutineObject.IsRunning = false;
408412
}
409-
base.OnDestroy();
413+
base.InternalOnDestroy();
410414
}
411415

412416
/// <summary>

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,16 @@ public override bool Initialize(string defaultWorldName)
115115
LastCreatedWorld = CreateLocalWorld("LocalWorld");
116116
}
117117

118-
OnInitialized?.Invoke();
118+
// Always wrap events that can invoke user script in a try-catch to assure any
119+
// proceeding script is still executed.
120+
try
121+
{
122+
OnInitialized?.Invoke();
123+
}
124+
catch (Exception ex)
125+
{
126+
Debug.LogException(ex);
127+
}
119128

120129
return true;
121130
}

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

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using Unity.Collections;
44
using Unity.Entities;
5+
using UnityEngine;
56

67
namespace Unity.Netcode.Components
78
{
@@ -69,7 +70,14 @@ protected override void OnUpdate()
6970

7071
foreach (var con in m_TempConnections)
7172
{
72-
NetworkManager.OnNetCodeDisconnect?.Invoke(con);
73+
try
74+
{
75+
NetworkManager.OnNetCodeDisconnect?.Invoke(con);
76+
}
77+
catch (System.Exception ex)
78+
{
79+
Debug.LogException(ex);
80+
}
7381
}
7482

7583
m_TempConnections.Clear();
@@ -101,7 +109,14 @@ protected override void OnUpdate()
101109
// Set the connection in-game
102110
commandBuffer.AddComponent<NetworkStreamInGame>(entry.Value.Entity);
103111
commandBuffer.AddComponent(entry.Value.Entity, new ConnectionState { NetworkId = entry.Value.NetworkId });
104-
NetworkManager.OnNetCodeConnect?.Invoke(entry.Value);
112+
try
113+
{
114+
NetworkManager.OnNetCodeConnect?.Invoke(entry.Value);
115+
}
116+
catch (System.Exception ex)
117+
{
118+
Debug.LogException(ex);
119+
}
105120
m_TempConnections.Add(entry.Value);
106121
}
107122
}
@@ -123,8 +138,14 @@ protected override void OnUpdate()
123138
foreach (var (networkId, entity) in SystemAPI.Query<NetworkId>().WithAll<ConnectionState>().WithEntityAccess())
124139
{
125140
commandBuffer.RemoveComponent<ConnectionState>(entity);
126-
NetworkManager.OnNetCodeDisconnect?.Invoke(new NetcodeConnection
127-
{ World = World, Entity = entity, NetworkId = networkId.Value });
141+
try
142+
{
143+
NetworkManager.OnNetCodeDisconnect?.Invoke(new NetcodeConnection { World = World, Entity = entity, NetworkId = networkId.Value });
144+
}
145+
catch (System.Exception ex)
146+
{
147+
Debug.LogException(ex);
148+
}
128149
}
129150
}
130151
commandBuffer.Playback(EntityManager);
@@ -139,7 +160,15 @@ protected override void OnDestroy()
139160
foreach (var (networkId, entity) in SystemAPI.Query<NetworkId>().WithEntityAccess())
140161
{
141162
commandBuffer.RemoveComponent<ConnectionState>(entity);
142-
NetworkManager.OnNetCodeDisconnect?.Invoke(new NetcodeConnection { World = World, Entity = entity, NetworkId = networkId.Value });
163+
164+
try
165+
{
166+
NetworkManager.OnNetCodeDisconnect?.Invoke(new NetcodeConnection { World = World, Entity = entity, NetworkId = networkId.Value });
167+
}
168+
catch (System.Exception ex)
169+
{
170+
Debug.LogException(ex);
171+
}
143172
}
144173
commandBuffer.Playback(EntityManager);
145174
base.OnDestroy();

0 commit comments

Comments
 (0)