Skip to content

Commit 3b1500f

Browse files
update
Simplifying this a bit as it is only used for testing purposes?
1 parent e761873 commit 3b1500f

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

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

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,12 @@ private struct PacketLossCache
361361
/// Multiplayer Tools subscribes to this event and does not have the EntityId udpate.
362362
/// </summary>
363363

364-
#if UNITY_6000_2_OR_NEWER && MP_TOOLS_2_2_8_OR_HIGHER
365-
internal static event Action<EntityId, NetworkDriver> TransportInitialized;
366-
internal static event Action<EntityId> TransportDisposed;
367-
#else
364+
#if UNITY_6000_2_OR_NEWER
365+
internal static event Action<EntityId, NetworkDriver> OnDriverInitialized;
366+
internal static event Action<EntityId> OnDisposingDriver;
367+
#endif
368368
internal static event Action<int, NetworkDriver> TransportInitialized;
369369
internal static event Action<int> TransportDisposed;
370-
#endif
371370

372371
/// <summary>
373372
/// Provides access to the <see cref="NetworkDriver"/> for this instance.
@@ -445,12 +444,9 @@ private void InitDriver()
445444
out m_UnreliableSequencedFragmentedPipeline,
446445
out m_ReliableSequencedPipeline);
447446
#if UNITY_6000_2_OR_NEWER
448-
#if MP_TOOLS_2_2_8_OR_HIGHER
449447
var entityId = GetEntityId();
450-
#else
451-
var entityId = GetEntityId().GetHashCode();
452-
#endif
453-
TransportInitialized?.Invoke(entityId, m_Driver);
448+
OnDriverInitialized?.Invoke(entityId, m_Driver);
449+
TransportInitialized?.Invoke(entityId.GetHashCode(), m_Driver);
454450
#else
455451
TransportInitialized?.Invoke(GetInstanceID(), m_Driver);
456452
#endif
@@ -471,12 +467,9 @@ private void DisposeInternals()
471467
m_SendQueue.Clear();
472468

473469
#if UNITY_6000_2_OR_NEWER
474-
#if MP_TOOLS_2_2_8_OR_HIGHER
475470
var entityId = GetEntityId();
476-
#else
477-
var entityId = GetEntityId().GetHashCode();
478-
#endif
479-
TransportDisposed?.Invoke(entityId);
471+
OnDisposingDriver?.Invoke(entityId);
472+
TransportDisposed?.Invoke(entityId.GetHashCode());
480473
#else
481474
TransportDisposed?.Invoke(GetInstanceID());
482475
#endif

0 commit comments

Comments
 (0)