Skip to content

Commit 612f8b6

Browse files
committed
Reverted removal of Tools define
1 parent ea44509 commit 612f8b6

File tree

6 files changed

+41
-1
lines changed

6 files changed

+41
-1
lines changed

com.unity.netcode.gameobjects/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
3030

3131
### Removed
3232

33-
- Removed usage of MULTIPLAYER_TOOLS_1_0_0_PRE_7 and UNITY_UNET_PRESENT defines (#3736)
33+
- Removed usage of UNITY_UNET_PRESENT define (#3736)
3434

3535
### Fixed
3636

com.unity.netcode.gameobjects/Runtime/Metrics/NetworkMetrics.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ private static string GetSceneEventTypeName(uint typeCode)
6363
private readonly EventMetric<SceneEventMetric> m_SceneEventSentEvent = new EventMetric<SceneEventMetric>(NetworkMetricTypes.SceneEventSent.Id);
6464
private readonly EventMetric<SceneEventMetric> m_SceneEventReceivedEvent = new EventMetric<SceneEventMetric>(NetworkMetricTypes.SceneEventReceived.Id);
6565

66+
#if MULTIPLAYER_TOOLS_1_0_0_PRE_7
6667
private readonly Counter m_PacketSentCounter = new Counter(NetworkMetricTypes.PacketsSent.Id)
6768
{
6869
ShouldResetOnDispatch = true,
@@ -84,6 +85,7 @@ private static string GetSceneEventTypeName(uint typeCode)
8485
ShouldResetOnDispatch = true,
8586
};
8687
private readonly Gauge m_PacketLossGauge = new Gauge(NetworkMetricTypes.PacketLoss.Id);
88+
#endif
8789

8890
private ulong m_NumberOfMetricsThisFrame;
8991

@@ -101,11 +103,13 @@ public NetworkMetrics()
101103
.WithMetricEvents(m_RpcSentEvent, m_RpcReceivedEvent)
102104
.WithMetricEvents(m_ServerLogSentEvent, m_ServerLogReceivedEvent)
103105
.WithMetricEvents(m_SceneEventSentEvent, m_SceneEventReceivedEvent)
106+
#if MULTIPLAYER_TOOLS_1_0_0_PRE_7
104107
.WithCounters(m_PacketSentCounter, m_PacketReceivedCounter)
105108
.WithGauges(m_RttToServerGauge)
106109
.WithGauges(m_NetworkObjectsGauge)
107110
.WithGauges(m_ConnectionsGauge)
108111
.WithGauges(m_PacketLossGauge)
112+
#endif
109113
.Build();
110114

111115
Dispatcher.RegisterObserver(NetcodeObserver.Observer);
@@ -433,64 +437,76 @@ public void TrackSceneEventReceived(ulong senderClientId, uint sceneEventType, s
433437

434438
public void TrackPacketSent(uint packetCount)
435439
{
440+
#if MULTIPLAYER_TOOLS_1_0_0_PRE_7
436441
if (!CanSendMetrics)
437442
{
438443
return;
439444
}
440445

441446
m_PacketSentCounter.Increment(packetCount);
442447
IncrementMetricCount();
448+
#endif
443449
}
444450

445451
public void TrackPacketReceived(uint packetCount)
446452
{
453+
#if MULTIPLAYER_TOOLS_1_0_0_PRE_7
447454
if (!CanSendMetrics)
448455
{
449456
return;
450457
}
451458

452459
m_PacketReceivedCounter.Increment(packetCount);
453460
IncrementMetricCount();
461+
#endif
454462
}
455463

456464
public void UpdateRttToServer(int rttMilliseconds)
457465
{
466+
#if MULTIPLAYER_TOOLS_1_0_0_PRE_7
458467
if (!CanSendMetrics)
459468
{
460469
return;
461470
}
462471
var rttSeconds = rttMilliseconds * 1e-3;
463472
m_RttToServerGauge.Set(rttSeconds);
473+
#endif
464474
}
465475

466476
public void UpdateNetworkObjectsCount(int count)
467477
{
478+
#if MULTIPLAYER_TOOLS_1_0_0_PRE_7
468479
if (!CanSendMetrics)
469480
{
470481
return;
471482
}
472483

473484
m_NetworkObjectsGauge.Set(count);
485+
#endif
474486
}
475487

476488
public void UpdateConnectionsCount(int count)
477489
{
490+
#if MULTIPLAYER_TOOLS_1_0_0_PRE_7
478491
if (!CanSendMetrics)
479492
{
480493
return;
481494
}
482495

483496
m_ConnectionsGauge.Set(count);
497+
#endif
484498
}
485499

486500
public void UpdatePacketLoss(float packetLoss)
487501
{
502+
#if MULTIPLAYER_TOOLS_1_0_0_PRE_7
488503
if (!CanSendMetrics)
489504
{
490505
return;
491506
}
492507

493508
m_PacketLossGauge.Set(packetLoss);
509+
#endif
494510
}
495511

496512
public void DispatchFrame()

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#if MULTIPLAYER_TOOLS
2+
#if MULTIPLAYER_TOOLS_1_0_0_PRE_7
23
using AOT;
34
using Unity.Burst;
45
using Unity.Collections.LowLevel.Unsafe;
@@ -65,3 +66,4 @@ private static void InitializeConnection(byte* staticInstanceBuffer, int staticI
6566
}
6667
}
6768
#endif
69+
#endif

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,9 @@ public void GetDefaultPipelineConfigurations(
597597
#if UNITY_MP_TOOLS_NETSIM_IMPLEMENTATION_ENABLED
598598
NetworkPipelineStageId.Get<SimulatorPipelineStage>(),
599599
#endif
600+
#if MULTIPLAYER_TOOLS_1_0_0_PRE_7
600601
NetworkPipelineStageId.Get<NetworkMetricsPipelineStage>(),
602+
#endif
601603
};
602604

603605
var unreliableSequencedFragmented = new NetworkPipelineStageId[]
@@ -607,7 +609,9 @@ public void GetDefaultPipelineConfigurations(
607609
#if UNITY_MP_TOOLS_NETSIM_IMPLEMENTATION_ENABLED
608610
NetworkPipelineStageId.Get<SimulatorPipelineStage>(),
609611
#endif
612+
#if MULTIPLAYER_TOOLS_1_0_0_PRE_7
610613
NetworkPipelineStageId.Get<NetworkMetricsPipelineStage>(),
614+
#endif
611615
};
612616

613617
var reliableSequenced = new NetworkPipelineStageId[]
@@ -616,7 +620,9 @@ public void GetDefaultPipelineConfigurations(
616620
#if UNITY_MP_TOOLS_NETSIM_IMPLEMENTATION_ENABLED
617621
NetworkPipelineStageId.Get<SimulatorPipelineStage>(),
618622
#endif
623+
#if MULTIPLAYER_TOOLS_1_0_0_PRE_7
619624
NetworkPipelineStageId.Get<NetworkMetricsPipelineStage>(),
625+
#endif
620626
};
621627

622628
unreliableFragmentedPipelineStages = new(unreliableFragmented, Allocator.Temp);
@@ -1078,10 +1084,12 @@ protected override void OnPostLateUpdate()
10781084
// current frame.
10791085
m_Driver.ScheduleFlushSend(default).Complete();
10801086

1087+
#if MULTIPLAYER_TOOLS_1_0_0_PRE_7
10811088
if (m_NetworkManager)
10821089
{
10831090
ExtractNetworkMetrics();
10841091
}
1092+
#endif
10851093
}
10861094
base.OnPostLateUpdate();
10871095
}
@@ -1091,6 +1099,7 @@ private void OnDestroy()
10911099
DisposeInternals();
10921100
}
10931101

1102+
#if MULTIPLAYER_TOOLS_1_0_0_PRE_7
10941103
private void ExtractNetworkMetrics()
10951104
{
10961105
if (m_NetworkManager.IsServer)
@@ -1158,6 +1167,7 @@ private void ExtractNetworkMetricsFromPipeline(NetworkPipeline pipeline, Network
11581167
networkMetricsContext->PacketReceivedCount = 0;
11591168
}
11601169
}
1170+
#endif
11611171

11621172
private int ExtractRtt(NetworkConnection networkConnection)
11631173
{
@@ -1703,7 +1713,9 @@ public void CreateDriver(
17031713
#endif
17041714
}
17051715

1716+
#if MULTIPLAYER_TOOLS_1_0_0_PRE_7
17061717
driver.RegisterPipelineStage(new NetworkMetricsPipelineStage());
1718+
#endif
17071719

17081720
GetDefaultPipelineConfigurations(
17091721
out var unreliableFragmentedPipelineStages,

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
"expression": "",
2929
"define": "MULTIPLAYER_TOOLS"
3030
},
31+
{
32+
"name": "com.unity.multiplayer.tools",
33+
"expression": "1.0.0-pre.7",
34+
"define": "MULTIPLAYER_TOOLS_1_0_0_PRE_7"
35+
},
3136
{
3237
"name": "Unity",
3338
"expression": "2023",

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

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

0 commit comments

Comments
 (0)