Skip to content

Commit 80b0c3c

Browse files
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.
1 parent b56e216 commit 80b0c3c

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

com.unity.netcode.gameobjects/Runtime/Transports/UTP/UnityTransport.cs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -360,17 +360,14 @@ private struct PacketLossCache
360360
/// TODO-FIXME:
361361
/// Multiplayer Tools subscribes to this event and does not have the EntityId udpate.
362362
/// </summary>
363-
#if FIXED
364-
#if UNITY_6000_2_OR_NEWER
363+
364+
#if UNITY_6000_2_OR_NEWER && MP_TOOLS_2_2_8_OR_HIGHER
365365
internal static event Action<EntityId, NetworkDriver> TransportInitialized;
366366
internal static event Action<EntityId> TransportDisposed;
367367
#else
368368
internal static event Action<int, NetworkDriver> TransportInitialized;
369369
internal static event Action<int> TransportDisposed;
370370
#endif
371-
#endif
372-
internal static event Action<int, NetworkDriver> TransportInitialized;
373-
internal static event Action<int> TransportDisposed;
374371

375372
/// <summary>
376373
/// Provides access to the <see cref="NetworkDriver"/> for this instance.
@@ -448,14 +445,12 @@ private void InitDriver()
448445
out m_UnreliableSequencedFragmentedPipeline,
449446
out m_ReliableSequencedPipeline);
450447
#if UNITY_6000_2_OR_NEWER
448+
#if MP_TOOLS_2_2_8_OR_HIGHER
451449
var entityId = GetEntityId();
452-
#if UNITY_6000_3_0A6_OR_HIGHER
453-
// TODO-FIXME: Since multiplayer tools subscribes to this and we have to validate against any package that
454-
// might use this action, we have to cast it down temporarily to avoid being blocked from getting these fixes in place.
455-
TransportInitialized?.Invoke((int)entityId.GetRawData(), m_Driver);
456450
#else
457-
TransportInitialized?.Invoke(entityId, m_Driver);
451+
var entityId = GetEntityId().GetHashCode();
458452
#endif
453+
TransportInitialized?.Invoke(entityId, m_Driver);
459454
#else
460455
TransportInitialized?.Invoke(GetInstanceID(), m_Driver);
461456
#endif
@@ -476,15 +471,12 @@ private void DisposeInternals()
476471
m_SendQueue.Clear();
477472

478473
#if UNITY_6000_2_OR_NEWER
474+
#if MP_TOOLS_2_2_8_OR_HIGHER
479475
var entityId = GetEntityId();
480-
#if UNITY_6000_3_0A6_OR_HIGHER
481-
// TODO-FIXME: Since multiplayer tools subscribes to this and we have to validate against any package that
482-
// might use this action, we have to cast it down temporarily to avoid being blocked from getting these fixes in place.
483-
TransportDisposed?.Invoke((int)entityId.GetRawData());
484476
#else
485-
TransportDisposed?.Invoke(entityId, m_Driver);
477+
var entityId = GetEntityId().GetHashCode();
486478
#endif
487-
479+
TransportDisposed?.Invoke(entityId);
488480
#else
489481
TransportDisposed?.Invoke(GetInstanceID());
490482
#endif

com.unity.netcode.gameobjects/Runtime/Unity.Netcode.Runtime.asmdef

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
"expression": "1.0.0-pre.7",
3434
"define": "MULTIPLAYER_TOOLS_1_0_0_PRE_7"
3535
},
36+
{
37+
"name": "com.unity.multiplayer.tools",
38+
"expression": "2.2.8",
39+
"define": "MP_TOOLS_2_2_8_OR_HIGHER"
40+
},
3641
{
3742
"name": "Unity",
3843
"expression": "2023",

0 commit comments

Comments
 (0)