File tree Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 1
1
version https://git-lfs.github.com/spec/v1
2
- oid sha256:20e32df83c703ac495cf5641ed1d7ea6b8737a4e5a7d32a3bbb8c0651e640809
3
- size 53296
2
+ oid sha256:9e8c165cd6442668e570fc8b7b0b88710f4393a8672241659b639cc07362fab6
3
+ size 53896
Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using TMPro ;
3
+ using Unity . Multiplayer . Tools . NetworkSimulator . Runtime ;
3
4
using UnityEngine ;
4
5
using Unity . Netcode ;
5
6
using Unity . Netcode . Transports . UTP ;
@@ -10,6 +11,9 @@ namespace Unity.BossRoom.Utils.Editor
10
11
{
11
12
public class NetworkLatencyWarning : MonoBehaviour
12
13
{
14
+ [ SerializeField ]
15
+ NetworkSimulator m_NetworkSimulator ;
16
+
13
17
TextMeshProUGUI m_LatencyText ;
14
18
bool m_LatencyTextCreated ;
15
19
@@ -25,10 +29,11 @@ void Update()
25
29
26
30
// adding this preprocessor directive check since UnityTransport's simulator tools only inject latency in #UNITY_EDITOR or in #DEVELOPMENT_BUILD
27
31
#if UNITY_EDITOR || DEVELOPMENT_BUILD
28
- var simulatorParameters = unityTransport . DebugSimulator ;
29
- m_ArtificialLatencyEnabled = simulatorParameters . PacketDelayMS > 0 ||
30
- simulatorParameters . PacketJitterMS > 0 ||
31
- simulatorParameters . PacketDropRate > 0 ;
32
+ var currentSimulationPreset = m_NetworkSimulator . CurrentPreset ;
33
+ m_ArtificialLatencyEnabled = currentSimulationPreset . PacketDelayMs > 0 ||
34
+ currentSimulationPreset . PacketJitterMs > 0 ||
35
+ currentSimulationPreset . PacketLossInterval > 0 ||
36
+ currentSimulationPreset . PacketLossPercent > 0 ;
32
37
#else
33
38
m_ArtificialLatencyEnabled = false ;
34
39
#endif
Original file line number Diff line number Diff line change 4
4
"references": [
5
5
"Unity.TextMeshPro",
6
6
"Unity.Netcode.Runtime",
7
+ "Unity.Multiplayer.Tools.NetworkSimulator.Runtime",
7
8
"Unity.Networking.Transport",
8
9
"Unity.Collections"
9
10
],
You can’t perform that action at this time.
0 commit comments