Skip to content

Commit f3a332b

Browse files
Merge branch 'develop-2.0.0' into fix/provide-checkvisibility-gating-networkshow-and-networkhide
2 parents 3c6781e + 7951347 commit f3a332b

15 files changed

Lines changed: 566 additions & 50 deletions

File tree

‎.yamato/ngo-publish.yml‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
ngo_release_preparation:
22
name: "NGO release preparation"
33
agent: { type: Unity::VM, flavor: b1.small, image: package-ci/ubuntu-22.04:v4 }
4-
triggers:
5-
recurring:
6-
- branch: develop-2.0.0 # We make new releases from this branch
7-
frequency: "10 ? * 1" # Runs every Sunday at 10:00 AM
84
commands:
95
- pip install PyGithub
106
- pip install GitPython

‎.yamato/wrench/preview-a-p-v.yml‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ preview_apv_-_6000_0_-_macos13:
7777
UNITY_LICENSING_SERVER_DELETE_ULF: 0
7878
UNITY_LICENSING_SERVER_TOOLSET: pro
7979
UPMPVP_CONTEXT_WRENCH: 3.12.1.0
80-
WRENCH_LOCALAPV_URL: https://artifactory.prd.it.unity3d.com/artifactory/stevedore-unity-internal/wrench-localapv/1-3-20_6ace78b5de8cf4671628832afa80f64bddc76883d89b9781fa19478b4bb33732.zip
80+
WRENCH_LOCALAPV_URL: https://artifactory.prd.it.unity3d.com/artifactory/stevedore-unity-internal/wrench-localapv/1-3-24_1493dea1e0eb932938365a4a53ec2091ec007ceec57eea844d15a058eddedc9f.zip
8181
metadata:
8282
Job Maintainers: '#rm-packageworks'
8383
Wrench: 3.12.1.0
@@ -136,7 +136,7 @@ preview_apv_-_6000_0_-_ubuntu2204:
136136
UNITY_LICENSING_SERVER_DELETE_ULF: 0
137137
UNITY_LICENSING_SERVER_TOOLSET: pro
138138
UPMPVP_CONTEXT_WRENCH: 3.12.1.0
139-
WRENCH_LOCALAPV_URL: https://artifactory.prd.it.unity3d.com/artifactory/stevedore-unity-internal/wrench-localapv/1-3-20_6ace78b5de8cf4671628832afa80f64bddc76883d89b9781fa19478b4bb33732.zip
139+
WRENCH_LOCALAPV_URL: https://artifactory.prd.it.unity3d.com/artifactory/stevedore-unity-internal/wrench-localapv/1-3-24_1493dea1e0eb932938365a4a53ec2091ec007ceec57eea844d15a058eddedc9f.zip
140140
metadata:
141141
Job Maintainers: '#rm-packageworks'
142142
Wrench: 3.12.1.0
@@ -196,7 +196,7 @@ preview_apv_-_6000_0_-_win10:
196196
UNITY_LICENSING_SERVER_DELETE_ULF: 0
197197
UNITY_LICENSING_SERVER_TOOLSET: pro
198198
UPMPVP_CONTEXT_WRENCH: 3.12.1.0
199-
WRENCH_LOCALAPV_URL: https://artifactory.prd.it.unity3d.com/artifactory/stevedore-unity-internal/wrench-localapv/1-3-20_6ace78b5de8cf4671628832afa80f64bddc76883d89b9781fa19478b4bb33732.zip
199+
WRENCH_LOCALAPV_URL: https://artifactory.prd.it.unity3d.com/artifactory/stevedore-unity-internal/wrench-localapv/1-3-24_1493dea1e0eb932938365a4a53ec2091ec007ceec57eea844d15a058eddedc9f.zip
200200
metadata:
201201
Job Maintainers: '#rm-packageworks'
202202
Wrench: 3.12.1.0
@@ -255,7 +255,7 @@ preview_apv_-_6000_3_-_macos13:
255255
UNITY_LICENSING_SERVER_DELETE_ULF: 0
256256
UNITY_LICENSING_SERVER_TOOLSET: pro
257257
UPMPVP_CONTEXT_WRENCH: 3.12.1.0
258-
WRENCH_LOCALAPV_URL: https://artifactory.prd.it.unity3d.com/artifactory/stevedore-unity-internal/wrench-localapv/1-3-20_6ace78b5de8cf4671628832afa80f64bddc76883d89b9781fa19478b4bb33732.zip
258+
WRENCH_LOCALAPV_URL: https://artifactory.prd.it.unity3d.com/artifactory/stevedore-unity-internal/wrench-localapv/1-3-24_1493dea1e0eb932938365a4a53ec2091ec007ceec57eea844d15a058eddedc9f.zip
259259
metadata:
260260
Job Maintainers: '#rm-packageworks'
261261
Wrench: 3.12.1.0
@@ -314,7 +314,7 @@ preview_apv_-_6000_3_-_ubuntu2204:
314314
UNITY_LICENSING_SERVER_DELETE_ULF: 0
315315
UNITY_LICENSING_SERVER_TOOLSET: pro
316316
UPMPVP_CONTEXT_WRENCH: 3.12.1.0
317-
WRENCH_LOCALAPV_URL: https://artifactory.prd.it.unity3d.com/artifactory/stevedore-unity-internal/wrench-localapv/1-3-20_6ace78b5de8cf4671628832afa80f64bddc76883d89b9781fa19478b4bb33732.zip
317+
WRENCH_LOCALAPV_URL: https://artifactory.prd.it.unity3d.com/artifactory/stevedore-unity-internal/wrench-localapv/1-3-24_1493dea1e0eb932938365a4a53ec2091ec007ceec57eea844d15a058eddedc9f.zip
318318
metadata:
319319
Job Maintainers: '#rm-packageworks'
320320
Wrench: 3.12.1.0
@@ -374,7 +374,7 @@ preview_apv_-_6000_3_-_win10:
374374
UNITY_LICENSING_SERVER_DELETE_ULF: 0
375375
UNITY_LICENSING_SERVER_TOOLSET: pro
376376
UPMPVP_CONTEXT_WRENCH: 3.12.1.0
377-
WRENCH_LOCALAPV_URL: https://artifactory.prd.it.unity3d.com/artifactory/stevedore-unity-internal/wrench-localapv/1-3-20_6ace78b5de8cf4671628832afa80f64bddc76883d89b9781fa19478b4bb33732.zip
377+
WRENCH_LOCALAPV_URL: https://artifactory.prd.it.unity3d.com/artifactory/stevedore-unity-internal/wrench-localapv/1-3-24_1493dea1e0eb932938365a4a53ec2091ec007ceec57eea844d15a058eddedc9f.zip
378378
metadata:
379379
Job Maintainers: '#rm-packageworks'
380380
Wrench: 3.12.1.0
@@ -434,7 +434,7 @@ preview_apv_-_6000_6_-_macos13arm:
434434
UNITY_LICENSING_SERVER_DELETE_ULF: 0
435435
UNITY_LICENSING_SERVER_TOOLSET: pro
436436
UPMPVP_CONTEXT_WRENCH: 3.12.1.0
437-
WRENCH_LOCALAPV_URL: https://artifactory.prd.it.unity3d.com/artifactory/stevedore-unity-internal/wrench-localapv/1-3-20_6ace78b5de8cf4671628832afa80f64bddc76883d89b9781fa19478b4bb33732.zip
437+
WRENCH_LOCALAPV_URL: https://artifactory.prd.it.unity3d.com/artifactory/stevedore-unity-internal/wrench-localapv/1-3-24_1493dea1e0eb932938365a4a53ec2091ec007ceec57eea844d15a058eddedc9f.zip
438438
metadata:
439439
Job Maintainers: '#rm-packageworks'
440440
Wrench: 3.12.1.0
@@ -493,7 +493,7 @@ preview_apv_-_6000_6_-_ubuntu2204:
493493
UNITY_LICENSING_SERVER_DELETE_ULF: 0
494494
UNITY_LICENSING_SERVER_TOOLSET: pro
495495
UPMPVP_CONTEXT_WRENCH: 3.12.1.0
496-
WRENCH_LOCALAPV_URL: https://artifactory.prd.it.unity3d.com/artifactory/stevedore-unity-internal/wrench-localapv/1-3-20_6ace78b5de8cf4671628832afa80f64bddc76883d89b9781fa19478b4bb33732.zip
496+
WRENCH_LOCALAPV_URL: https://artifactory.prd.it.unity3d.com/artifactory/stevedore-unity-internal/wrench-localapv/1-3-24_1493dea1e0eb932938365a4a53ec2091ec007ceec57eea844d15a058eddedc9f.zip
497497
metadata:
498498
Job Maintainers: '#rm-packageworks'
499499
Wrench: 3.12.1.0
@@ -553,7 +553,7 @@ preview_apv_-_6000_6_-_win10:
553553
UNITY_LICENSING_SERVER_DELETE_ULF: 0
554554
UNITY_LICENSING_SERVER_TOOLSET: pro
555555
UPMPVP_CONTEXT_WRENCH: 3.12.1.0
556-
WRENCH_LOCALAPV_URL: https://artifactory.prd.it.unity3d.com/artifactory/stevedore-unity-internal/wrench-localapv/1-3-20_6ace78b5de8cf4671628832afa80f64bddc76883d89b9781fa19478b4bb33732.zip
556+
WRENCH_LOCALAPV_URL: https://artifactory.prd.it.unity3d.com/artifactory/stevedore-unity-internal/wrench-localapv/1-3-24_1493dea1e0eb932938365a4a53ec2091ec007ceec57eea844d15a058eddedc9f.zip
557557
metadata:
558558
Job Maintainers: '#rm-packageworks'
559559
Wrench: 3.12.1.0

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ Additional documentation and release notes are available at [Multiplayer Documen
2222

2323
### Fixed
2424

25-
- Fixed an issue where mixed authority nested `NetworkTransform` instances could stop child/nested instances from updating because an authoritative `NetworkTransform` (root or otherwise) would remove the `NetworkObject` from the update group, preventing non-authoritative instances from updating their state on the authority side. (#4169)
25+
- Issue where a `FastBufferReader` created with an offset and the default length of -1 read past the end of its source. The `ArraySegment<byte>` overload that takes an offset now applies it from the start of the segment. (#4221)
26+
- Issue where a client synchronized while a `NetworkList<T>` still had unsent changes applied those changes twice, resulting in duplicate entries and index-based events landing on the wrong elements on that client. (#4215)
27+
- Issue where showing a `NetworkObject` with `NetworkShow` while its `NetworkVariable` updates were held back by `NetworkVariableUpdateTraits` stopped those pending changes from being sent until the variable was modified again. (#4215)
28+
- Issue where moving a `NetworkObject` into another scene made the clients that did not observe it log "Trying to synchronize NetworkObjectId but it was not spawned". The scene migration is now only sent to the clients that observe the `NetworkObject`. (#4185)
29+
- Issue where a `NetworkObject` that was moved into another scene while hidden from a client spawned in that client's active scene when it was shown with `NetworkShow`, instead of the scene it is in on the server. (#4185)
30+
- Issue where mixed authority nested `NetworkTransform` instances could stop child/nested instances from updating because an authoritative `NetworkTransform` (root or otherwise) would remove the `NetworkObject` from the update group, preventing non-authoritative instances from updating their state on the authority side. (#4169)
2631

2732
### Security
2833

‎com.unity.netcode.gameobjects/Runtime/Core/NetworkBehaviourUpdater.cs‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,19 @@ internal void ForceSendIfDirtyOnNetworkShow(NetworkObject networkObject)
138138
// Remove it from the pending and queued dirty objects lists
139139
m_PendingDirtyNetworkObjects.Remove(networkObject);
140140
m_DirtyNetworkObjects.Remove(networkObject);
141+
142+
// Anything still dirty was held back by its update traits, keep it queued so a later tick sends it
143+
foreach (var behaviour in networkObject.ChildNetworkBehaviours.Values)
144+
{
145+
foreach (var networkVariable in behaviour.NetworkVariableFields)
146+
{
147+
if (networkVariable.IsDirty())
148+
{
149+
AddForUpdate(networkObject);
150+
return;
151+
}
152+
}
153+
}
141154
}
142155

143156
/// <summary>

‎com.unity.netcode.gameobjects/Runtime/Messaging/Messages/CreateObjectMessage.cs‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,13 @@ internal static void CreateObject(ref NetworkManager networkManager, ulong sende
178178
networkManager.Log.ErrorServer(new Context(LogLevel.Developer, $"Failed to deserialize {nameof(NetworkObject)}.").AddInfo(nameof(NetworkObject.GlobalObjectIdHash), serializedObject.Hash).AddInfo(nameof(NetworkObject.NetworkObjectId), serializedObject.NetworkObjectId));
179179
return;
180180
}
181+
182+
// A NetworkObject shown to this client after it migrated into another scene was instantiated in the
183+
// active scene, and the migration was only sent to the clients observing it at the time.
184+
if (networkManager.NetworkConfig.EnableSceneManagement)
185+
{
186+
networkManager.SceneManager.SynchronizeNetworkObjectScene(networkObject);
187+
}
181188
}
182189
else
183190
{
@@ -206,6 +213,12 @@ internal static void CreateObject(ref NetworkManager networkManager, ulong sende
206213
networkManager.Log.ErrorServer(new Context(LogLevel.Developer, $"Failed to deserialize {nameof(NetworkObject)}.").AddInfo(nameof(NetworkObject.GlobalObjectIdHash), serializedObject.Hash).AddInfo(nameof(NetworkObject.NetworkObjectId), serializedObject.NetworkObjectId));
207214
return;
208215
}
216+
217+
// Same as client-server: the migration was only sent to the clients observing it at the time
218+
if (networkManager.NetworkConfig.EnableSceneManagement)
219+
{
220+
networkManager.SceneManager.SynchronizeNetworkObjectScene(networkObject);
221+
}
209222
}
210223

211224
// DA - NGO CMB SERVICE NOTES:

‎com.unity.netcode.gameobjects/Runtime/NetworkVariable/Collections/NetworkList.cs‎

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ public class NetworkList<T> : NetworkVariableBase where T : unmanaged, IEquatabl
1616
private NativeList<T> m_List = new NativeList<T>(64, Allocator.Persistent);
1717
private NativeList<NetworkListEvent<T>> m_DirtyEvents = new NativeList<NetworkListEvent<T>>(64, Allocator.Persistent);
1818

19+
// The list as it was before the first local change that is still pending in m_DirtyEvents
20+
private NativeList<T> m_LastSentList = new NativeList<T>(64, Allocator.Persistent);
21+
private bool m_HasLastSentList;
22+
1923
/// <summary>
2024
/// Delegate type for list changed event
2125
/// </summary>
@@ -67,6 +71,7 @@ public override void ResetDirty()
6771
{
6872
m_DirtyEvents.Clear();
6973
}
74+
m_HasLastSentList = false;
7075
}
7176

7277
/// <inheritdoc cref="NetworkVariable{T}.IsDirty"/>
@@ -149,10 +154,42 @@ private T ReadValue(FastBufferReader reader)
149154
/// <inheritdoc cref="NetworkVariable{T}.WriteField"/>
150155
public override void WriteField(FastBufferWriter writer)
151156
{
152-
writer.WriteValueSafe((ushort)m_List.Length);
153-
for (int i = 0; i < m_List.Length; i++)
157+
WriteList(writer, m_List);
158+
}
159+
160+
internal override void WriteFieldSynchronization(FastBufferWriter writer)
161+
{
162+
// The pending events are sent to the synchronizing client with the next delta, so it must
163+
// receive the list they apply to. Otherwise it would apply them twice.
164+
if (m_HasLastSentList && m_DirtyEvents.Length > 0)
165+
{
166+
WriteList(writer, m_LastSentList);
167+
}
168+
else
169+
{
170+
base.WriteFieldSynchronization(writer);
171+
}
172+
}
173+
174+
private static void WriteList(FastBufferWriter writer, NativeList<T> list)
175+
{
176+
writer.WriteValueSafe((ushort)list.Length);
177+
for (int i = 0; i < list.Length; i++)
154178
{
155-
NetworkVariableSerialization<T>.Serializer.Write(writer, ref m_List.ElementAt(i));
179+
NetworkVariableSerialization<T>.Serializer.Write(writer, ref list.ElementAt(i));
180+
}
181+
}
182+
183+
/// <summary>
184+
/// Invoked before a local change. Keeps a copy of the list as of the last sent delta
185+
/// so <see cref="WriteFieldSynchronization"/> can send it while changes are pending.
186+
/// </summary>
187+
private void CaptureLastSentList()
188+
{
189+
if (m_DirtyEvents.Length == 0)
190+
{
191+
m_LastSentList.CopyFrom(m_List);
192+
m_HasLastSentList = true;
156193
}
157194
}
158195

@@ -439,6 +476,7 @@ public void Add(T item)
439476
return;
440477
}
441478

479+
CaptureLastSentList();
442480
m_List.Add(item);
443481

444482
var listEvent = new NetworkListEvent<T>()
@@ -466,6 +504,7 @@ public void Clear()
466504
return;
467505
}
468506

507+
CaptureLastSentList();
469508
m_List.Clear();
470509

471510
var listEvent = new NetworkListEvent<T>()
@@ -510,6 +549,7 @@ public bool Remove(T item)
510549
return false;
511550
}
512551

552+
CaptureLastSentList();
513553
m_List.RemoveAt(index);
514554
var listEvent = new NetworkListEvent<T>()
515555
{
@@ -553,6 +593,7 @@ public void Insert(int index, T item)
553593
return;
554594
}
555595

596+
CaptureLastSentList();
556597
if (index < m_List.Length)
557598
{
558599
m_List.InsertRangeWithBeginEnd(index, index + 1);
@@ -589,6 +630,7 @@ public void RemoveAt(int index)
589630
}
590631

591632
var value = m_List[index];
633+
CaptureLastSentList();
592634
m_List.RemoveAt(index);
593635

594636
var listEvent = new NetworkListEvent<T>()
@@ -631,6 +673,7 @@ public void Set(int index, T value, bool forceUpdate = false)
631673
return;
632674
}
633675

676+
CaptureLastSentList();
634677
m_List[index] = value;
635678

636679
var listEvent = new NetworkListEvent<T>()
@@ -706,6 +749,11 @@ public override void Dispose()
706749
m_DirtyEvents.Dispose();
707750
}
708751

752+
if (m_LastSentList.IsCreated)
753+
{
754+
m_LastSentList.Dispose();
755+
}
756+
709757
base.Dispose();
710758
}
711759
}

0 commit comments

Comments
 (0)