Skip to content

Commit

Permalink
fix: Compatibility fixes for UTP 2.X (#2786)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
simon-lemay-unity and NoelStephensUnity authored Dec 8, 2023
1 parent 13d1f8c commit 01e8738
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,12 @@ internal unsafe int SendMessage<T>(ref T message, NetworkDelivery delivery, in N
return SendMessage(ref message, delivery, new PointerListWrapper<ulong>((ulong*)clientIds.GetUnsafePtr(), clientIds.Length));
}

internal unsafe int SendMessage<T>(ref T message, NetworkDelivery delivery, in NativeList<ulong> clientIds)
where T : INetworkMessage
{
return SendMessage(ref message, delivery, new PointerListWrapper<ulong>((ulong*)clientIds.GetUnsafePtr(), clientIds.Length));
}

internal unsafe void ProcessSendQueues()
{
if (StopProcessing)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal class ProxyRpcTargetGroup : BaseRpcTarget, IDisposable, IGroupRpcTarget

internal override void Send(NetworkBehaviour behaviour, ref RpcMessage message, NetworkDelivery delivery, RpcParams rpcParams)
{
var proxyMessage = new ProxyMessage { Delivery = delivery, TargetClientIds = TargetClientIds, WrappedMessage = message };
var proxyMessage = new ProxyMessage { Delivery = delivery, TargetClientIds = TargetClientIds.AsArray(), WrappedMessage = message };
#if DEVELOPMENT_BUILD || UNITY_EDITOR
var size =
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public IEnumerator NetworkTransformMultipleChangesOverTime([Values] TransformSpa
// Wait for the deltas to be pushed
yield return WaitForConditionOrTimeOut(() => m_AuthoritativeTransform.StatePushed);

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

// For 3 axis, we will skip validating that the non-authority interpolates to its target point at least once.
// This will validate that non-authoritative updates are maintaining their target state axis values if only 2
// This will validate that non-authoritative updates are maintaining their target state axis values if only 2
// of the axis are being updated to assure interpolation maintains the targeted axial value per axis.
// For 2 and 1 axis tests we always validate per delta update
if (m_AxisExcluded || axisCount < 3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
using UnityEngine.TestTools;
using Object = UnityEngine.Object;

// TODO: Rewrite test to use the tools package. Debug simulator not available in UTP 2.X.
#if !UTP_TRANSPORT_2_0_ABOVE

namespace TestProject.RuntimeTests
{
/// <summary>
Expand Down Expand Up @@ -320,3 +323,4 @@ protected override IEnumerator OnTearDown()
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
"name": "com.unity.addressables",
"expression": "",
"define": "TESTPROJECT_USE_ADDRESSABLES"
},
{
"name": "com.unity.transport",
"expression": "2.0.0-exp",
"define": "UTP_TRANSPORT_2_0_ABOVE"
}
]
}

0 comments on commit 01e8738

Please sign in to comment.