Skip to content

Commit 30d219d

Browse files
committed
Removed the connecton approval callback missing warning when running as client
1 parent 3169ce5 commit 30d219d

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

MLAPI/MonoBehaviours/Core/NetworkingManager.cs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ private ConnectionConfig Init(NetworkingConfiguration netConfig)
197197
spawnedObjects = new Dictionary<uint, NetworkedObject>();
198198
spawnedObjectIds = new List<uint>();
199199
releasedNetworkObjectIds = new Stack<uint>();
200-
if(NetworkConfig.HandleObjectSpawning)
200+
if (NetworkConfig.HandleObjectSpawning)
201201
{
202202
NetworkedObject[] sceneObjects = FindObjectsOfType<NetworkedObject>();
203203
for (int i = 0; i < sceneObjects.Length; i++)
@@ -208,14 +208,6 @@ private ConnectionConfig Init(NetworkingConfiguration netConfig)
208208
}
209209
}
210210

211-
if (NetworkConfig.ConnectionApproval)
212-
{
213-
if(NetworkConfig.ConnectionApprovalCallback == null)
214-
{
215-
Debug.LogWarning("MLAPI: No ConnectionApproval callback defined. Connection approval will timeout");
216-
}
217-
}
218-
219211
NetworkTransport.Init();
220212
ConnectionConfig cConfig = new ConnectionConfig();
221213

@@ -249,6 +241,14 @@ private ConnectionConfig Init(NetworkingConfiguration netConfig)
249241

250242
public void StartServer(NetworkingConfiguration netConfig)
251243
{
244+
if (NetworkConfig.ConnectionApproval)
245+
{
246+
if (NetworkConfig.ConnectionApprovalCallback == null)
247+
{
248+
Debug.LogWarning("MLAPI: No ConnectionApproval callback defined. Connection approval will timeout");
249+
}
250+
}
251+
252252
SceneManager.LoadScene(PlaySceneIndex);
253253
ConnectionConfig cConfig = Init(netConfig);
254254
HostTopology hostTopology = new HostTopology(cConfig, NetworkConfig.MaxConnections);
@@ -273,6 +273,14 @@ public void StartClient(NetworkingConfiguration netConfig)
273273

274274
public void StartHost(NetworkingConfiguration netConfig)
275275
{
276+
if (NetworkConfig.ConnectionApproval)
277+
{
278+
if (NetworkConfig.ConnectionApprovalCallback == null)
279+
{
280+
Debug.LogWarning("MLAPI: No ConnectionApproval callback defined. Connection approval will timeout");
281+
}
282+
}
283+
276284
SceneManager.LoadScene(PlaySceneIndex);
277285
ConnectionConfig cConfig = Init(netConfig);
278286
HostTopology hostTopology = new HostTopology(cConfig, NetworkConfig.MaxConnections);

0 commit comments

Comments
 (0)