Skip to content

Commit b49445a

Browse files
authored
fix: NetworkNavMeshAgent now uses owner NetworkManager (#786)
1 parent c424046 commit b49445a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

com.unity.multiplayer.mlapi/Prototyping/NetworkNavMeshAgent.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ private void Update()
6767
else
6868
{
6969
var proximityClients = new List<ulong>();
70-
foreach (KeyValuePair<ulong, NetworkClient> client in NetworkManager.Singleton.ConnectedClients)
70+
foreach (KeyValuePair<ulong, NetworkClient> client in NetworkManager.ConnectedClients)
7171
{
7272
if (client.Value.PlayerObject == null || Vector3.Distance(client.Value.PlayerObject.transform.position, transform.position) <= ProximityRange)
7373
{
@@ -79,7 +79,7 @@ private void Update()
7979
}
8080
}
8181

82-
if (NetworkManager.Singleton.NetworkTime - m_LastCorrectionTime >= CorrectionDelay)
82+
if (NetworkManager.NetworkTime - m_LastCorrectionTime >= CorrectionDelay)
8383
{
8484
if (!EnableProximity)
8585
{
@@ -88,7 +88,7 @@ private void Update()
8888
else
8989
{
9090
var proximityClients = new List<ulong>();
91-
foreach (KeyValuePair<ulong, NetworkClient> client in NetworkManager.Singleton.ConnectedClients)
91+
foreach (KeyValuePair<ulong, NetworkClient> client in NetworkManager.ConnectedClients)
9292
{
9393
if (client.Value.PlayerObject == null || Vector3.Distance(client.Value.PlayerObject.transform.position, transform.position) <= ProximityRange)
9494
{
@@ -99,7 +99,7 @@ private void Update()
9999
OnNavMeshCorrectionUpdateClientRpc(m_Agent.velocity, transform.position, new ClientRpcParams { Send = new ClientRpcSendParams { TargetClientIds = proximityClients.ToArray() } });
100100
}
101101

102-
m_LastCorrectionTime = NetworkManager.Singleton.NetworkTime;
102+
m_LastCorrectionTime = NetworkManager.NetworkTime;
103103
}
104104
}
105105

0 commit comments

Comments
 (0)