Skip to content

Commit 01e8738

Browse files
fix: Compatibility fixes for UTP 2.X (#2786)
* fix: Compatibility fixes for UTP 2.X * Remove fix that will be included in different PR * Add new NativeList overload for NetworkMessageManager.SendMessage --------- Co-authored-by: Noel Stephens <[email protected]>
1 parent 13d1f8c commit 01e8738

File tree

5 files changed

+18
-3
lines changed

5 files changed

+18
-3
lines changed

com.unity.netcode.gameobjects/Runtime/Messaging/NetworkMessageManager.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,12 @@ internal unsafe int SendMessage<T>(ref T message, NetworkDelivery delivery, in N
820820
return SendMessage(ref message, delivery, new PointerListWrapper<ulong>((ulong*)clientIds.GetUnsafePtr(), clientIds.Length));
821821
}
822822

823+
internal unsafe int SendMessage<T>(ref T message, NetworkDelivery delivery, in NativeList<ulong> clientIds)
824+
where T : INetworkMessage
825+
{
826+
return SendMessage(ref message, delivery, new PointerListWrapper<ulong>((ulong*)clientIds.GetUnsafePtr(), clientIds.Length));
827+
}
828+
823829
internal unsafe void ProcessSendQueues()
824830
{
825831
if (StopProcessing)

com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/ProxyRpcTargetGroup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal class ProxyRpcTargetGroup : BaseRpcTarget, IDisposable, IGroupRpcTarget
1717

1818
internal override void Send(NetworkBehaviour behaviour, ref RpcMessage message, NetworkDelivery delivery, RpcParams rpcParams)
1919
{
20-
var proxyMessage = new ProxyMessage { Delivery = delivery, TargetClientIds = TargetClientIds, WrappedMessage = message };
20+
var proxyMessage = new ProxyMessage { Delivery = delivery, TargetClientIds = TargetClientIds.AsArray(), WrappedMessage = message };
2121
#if DEVELOPMENT_BUILD || UNITY_EDITOR
2222
var size =
2323
#endif

com.unity.netcode.gameobjects/Tests/Runtime/NetworkTransform/NetworkTransformPacketLossTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ public IEnumerator NetworkTransformMultipleChangesOverTime([Values] TransformSpa
257257
// Wait for the deltas to be pushed
258258
yield return WaitForConditionOrTimeOut(() => m_AuthoritativeTransform.StatePushed);
259259

260-
// Just in case we drop the first few state updates
260+
// Just in case we drop the first few state updates
261261
if (s_GlobalTimeoutHelper.TimedOut)
262262
{
263263
// Set the local state to not reflect the authority state's local space settings
@@ -315,7 +315,7 @@ public IEnumerator NetworkTransformMultipleChangesOverTime([Values] TransformSpa
315315
AssertOnTimeout($"[Non-Interpolate {i}] Timed out waiting for state to be pushed ({m_AuthoritativeTransform.StatePushed})!");
316316

317317
// For 3 axis, we will skip validating that the non-authority interpolates to its target point at least once.
318-
// This will validate that non-authoritative updates are maintaining their target state axis values if only 2
318+
// This will validate that non-authoritative updates are maintaining their target state axis values if only 2
319319
// of the axis are being updated to assure interpolation maintains the targeted axial value per axis.
320320
// For 2 and 1 axis tests we always validate per delta update
321321
if (m_AxisExcluded || axisCount < 3)

testproject/Assets/Tests/Runtime/NetworkSceneManager/NetworkSceneManagerFixValidationTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
using UnityEngine.TestTools;
1010
using Object = UnityEngine.Object;
1111

12+
// TODO: Rewrite test to use the tools package. Debug simulator not available in UTP 2.X.
13+
#if !UTP_TRANSPORT_2_0_ABOVE
14+
1215
namespace TestProject.RuntimeTests
1316
{
1417
/// <summary>
@@ -320,3 +323,4 @@ protected override IEnumerator OnTearDown()
320323
}
321324
}
322325
}
326+
#endif

testproject/Assets/Tests/Runtime/testproject.runtimetests.asmdef

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
"name": "com.unity.addressables",
2727
"expression": "",
2828
"define": "TESTPROJECT_USE_ADDRESSABLES"
29+
},
30+
{
31+
"name": "com.unity.transport",
32+
"expression": "2.0.0-exp",
33+
"define": "UTP_TRANSPORT_2_0_ABOVE"
2934
}
3035
]
3136
}

0 commit comments

Comments
 (0)