From 80b0c3c78ffef537203bedc18b7921a14b8d1afa Mon Sep 17 00:00:00 2001 From: Noel Stephens Date: Mon, 1 Dec 2025 13:27:49 -0600 Subject: [PATCH 1/5] update Initial approach to resolve the circular dependency will be to use two unique defines created by both packages. NGO will use the assembly version define MP_TOOLS_2_2_8_OR_HIGHER. MP Tools will use the assembly version define NGO_2_8_0_OR_HIGHER. --- .../Runtime/Transports/UTP/UnityTransport.cs | 24 +++++++------------ .../Runtime/Unity.Netcode.Runtime.asmdef | 5 ++++ 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs b/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs index cf207cc725..ab6d4b596b 100644 --- a/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs +++ b/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs @@ -360,17 +360,14 @@ private struct PacketLossCache /// TODO-FIXME: /// Multiplayer Tools subscribes to this event and does not have the EntityId udpate. /// -#if FIXED -#if UNITY_6000_2_OR_NEWER + +#if UNITY_6000_2_OR_NEWER && MP_TOOLS_2_2_8_OR_HIGHER internal static event Action TransportInitialized; internal static event Action TransportDisposed; #else internal static event Action TransportInitialized; internal static event Action TransportDisposed; #endif -#endif - internal static event Action TransportInitialized; - internal static event Action TransportDisposed; /// /// Provides access to the for this instance. @@ -448,14 +445,12 @@ private void InitDriver() out m_UnreliableSequencedFragmentedPipeline, out m_ReliableSequencedPipeline); #if UNITY_6000_2_OR_NEWER +#if MP_TOOLS_2_2_8_OR_HIGHER var entityId = GetEntityId(); -#if UNITY_6000_3_0A6_OR_HIGHER - // TODO-FIXME: Since multiplayer tools subscribes to this and we have to validate against any package that - // might use this action, we have to cast it down temporarily to avoid being blocked from getting these fixes in place. - TransportInitialized?.Invoke((int)entityId.GetRawData(), m_Driver); #else - TransportInitialized?.Invoke(entityId, m_Driver); + var entityId = GetEntityId().GetHashCode(); #endif + TransportInitialized?.Invoke(entityId, m_Driver); #else TransportInitialized?.Invoke(GetInstanceID(), m_Driver); #endif @@ -476,15 +471,12 @@ private void DisposeInternals() m_SendQueue.Clear(); #if UNITY_6000_2_OR_NEWER +#if MP_TOOLS_2_2_8_OR_HIGHER var entityId = GetEntityId(); -#if UNITY_6000_3_0A6_OR_HIGHER - // TODO-FIXME: Since multiplayer tools subscribes to this and we have to validate against any package that - // might use this action, we have to cast it down temporarily to avoid being blocked from getting these fixes in place. - TransportDisposed?.Invoke((int)entityId.GetRawData()); #else - TransportDisposed?.Invoke(entityId, m_Driver); + var entityId = GetEntityId().GetHashCode(); #endif - + TransportDisposed?.Invoke(entityId); #else TransportDisposed?.Invoke(GetInstanceID()); #endif diff --git a/com.unity.netcode.gameobjects/Runtime/Unity.Netcode.Runtime.asmdef b/com.unity.netcode.gameobjects/Runtime/Unity.Netcode.Runtime.asmdef index e76f8e8360..ec184f80cd 100644 --- a/com.unity.netcode.gameobjects/Runtime/Unity.Netcode.Runtime.asmdef +++ b/com.unity.netcode.gameobjects/Runtime/Unity.Netcode.Runtime.asmdef @@ -33,6 +33,11 @@ "expression": "1.0.0-pre.7", "define": "MULTIPLAYER_TOOLS_1_0_0_PRE_7" }, + { + "name": "com.unity.multiplayer.tools", + "expression": "2.2.8", + "define": "MP_TOOLS_2_2_8_OR_HIGHER" + }, { "name": "Unity", "expression": "2023", From e76187308fc3780a24c345ae9a60d285685eaab6 Mon Sep 17 00:00:00 2001 From: Noel Stephens Date: Mon, 1 Dec 2025 14:54:32 -0600 Subject: [PATCH 2/5] style whitespace adjustments --- .../Runtime/Unity.Netcode.Runtime.asmdef | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/com.unity.netcode.gameobjects/Runtime/Unity.Netcode.Runtime.asmdef b/com.unity.netcode.gameobjects/Runtime/Unity.Netcode.Runtime.asmdef index ec184f80cd..d1d4b29bcb 100644 --- a/com.unity.netcode.gameobjects/Runtime/Unity.Netcode.Runtime.asmdef +++ b/com.unity.netcode.gameobjects/Runtime/Unity.Netcode.Runtime.asmdef @@ -89,10 +89,10 @@ "define": "SCENE_MANAGEMENT_SCENE_HANDLE_NO_INT_CONVERSION" }, { - "name": "Unity", - "expression": "6000.5.0a1", - "define": "SCENE_MANAGEMENT_SCENE_HANDLE_MUST_USE_ULONG" + "name": "Unity", + "expression": "6000.5.0a1", + "define": "SCENE_MANAGEMENT_SCENE_HANDLE_MUST_USE_ULONG" } ], "noEngineReferences": false -} +} \ No newline at end of file From 3b1500f9ca308392986d3ad8728455b0b2ad190e Mon Sep 17 00:00:00 2001 From: Noel Stephens Date: Mon, 1 Dec 2025 15:30:27 -0600 Subject: [PATCH 3/5] update Simplifying this a bit as it is only used for testing purposes? --- .../Runtime/Transports/UTP/UnityTransport.cs | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs b/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs index ab6d4b596b..80233e23d1 100644 --- a/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs +++ b/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs @@ -361,13 +361,12 @@ private struct PacketLossCache /// Multiplayer Tools subscribes to this event and does not have the EntityId udpate. /// -#if UNITY_6000_2_OR_NEWER && MP_TOOLS_2_2_8_OR_HIGHER - internal static event Action TransportInitialized; - internal static event Action TransportDisposed; -#else +#if UNITY_6000_2_OR_NEWER + internal static event Action OnDriverInitialized; + internal static event Action OnDisposingDriver; +#endif internal static event Action TransportInitialized; internal static event Action TransportDisposed; -#endif /// /// Provides access to the for this instance. @@ -445,12 +444,9 @@ private void InitDriver() out m_UnreliableSequencedFragmentedPipeline, out m_ReliableSequencedPipeline); #if UNITY_6000_2_OR_NEWER -#if MP_TOOLS_2_2_8_OR_HIGHER var entityId = GetEntityId(); -#else - var entityId = GetEntityId().GetHashCode(); -#endif - TransportInitialized?.Invoke(entityId, m_Driver); + OnDriverInitialized?.Invoke(entityId, m_Driver); + TransportInitialized?.Invoke(entityId.GetHashCode(), m_Driver); #else TransportInitialized?.Invoke(GetInstanceID(), m_Driver); #endif @@ -471,12 +467,9 @@ private void DisposeInternals() m_SendQueue.Clear(); #if UNITY_6000_2_OR_NEWER -#if MP_TOOLS_2_2_8_OR_HIGHER var entityId = GetEntityId(); -#else - var entityId = GetEntityId().GetHashCode(); -#endif - TransportDisposed?.Invoke(entityId); + OnDisposingDriver?.Invoke(entityId); + TransportDisposed?.Invoke(entityId.GetHashCode()); #else TransportDisposed?.Invoke(GetInstanceID()); #endif From 8c1b6fc8ac17f00d01c69e7c5696bf09e766702f Mon Sep 17 00:00:00 2001 From: Noel Stephens Date: Mon, 1 Dec 2025 17:24:46 -0600 Subject: [PATCH 4/5] update Removing this version define as it is no longer needed. --- .../Runtime/Unity.Netcode.Runtime.asmdef | 5 ----- 1 file changed, 5 deletions(-) diff --git a/com.unity.netcode.gameobjects/Runtime/Unity.Netcode.Runtime.asmdef b/com.unity.netcode.gameobjects/Runtime/Unity.Netcode.Runtime.asmdef index d1d4b29bcb..c43f102051 100644 --- a/com.unity.netcode.gameobjects/Runtime/Unity.Netcode.Runtime.asmdef +++ b/com.unity.netcode.gameobjects/Runtime/Unity.Netcode.Runtime.asmdef @@ -33,11 +33,6 @@ "expression": "1.0.0-pre.7", "define": "MULTIPLAYER_TOOLS_1_0_0_PRE_7" }, - { - "name": "com.unity.multiplayer.tools", - "expression": "2.2.8", - "define": "MP_TOOLS_2_2_8_OR_HIGHER" - }, { "name": "Unity", "expression": "2023", From 0556a7a626103959fedd8a4c17f11ce490741c03 Mon Sep 17 00:00:00 2001 From: Noel Stephens Date: Mon, 1 Dec 2025 19:26:07 -0600 Subject: [PATCH 5/5] style Removing comment --- .../Runtime/Transports/UTP/UnityTransport.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs b/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs index 80233e23d1..1340117f36 100644 --- a/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs +++ b/com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs @@ -356,11 +356,6 @@ private struct PacketLossCache public float PacketLoss; }; - /// - /// TODO-FIXME: - /// Multiplayer Tools subscribes to this event and does not have the EntityId udpate. - /// - #if UNITY_6000_2_OR_NEWER internal static event Action OnDriverInitialized; internal static event Action OnDisposingDriver;