Skip to content

Commit 847b8fc

Browse files
committed
fix: Added error handling when the NetworkingManager is a NetworkedObject
Fixes: #206
1 parent b68568c commit 847b8fc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

MLAPI/MonoBehaviours/Core/NetworkingManager.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,11 @@ private void OnValidate()
235235
if (NetworkConfig == null)
236236
return; //May occur when the component is added
237237

238+
if (GetComponentInChildren<NetworkedObject>() != null)
239+
{
240+
if (LogHelper.CurrentLogLevel <= LogLevel.Normal) LogHelper.LogWarning("The NetworkingManager cannot be a NetworkedObject. This will lead to weird side effects.");
241+
}
242+
238243
if (!NetworkConfig.RegisteredScenes.Contains(SceneManager.GetActiveScene().name))
239244
{
240245
if (LogHelper.CurrentLogLevel <= LogLevel.Normal) LogHelper.LogWarning("The active scene is not registered as a networked scene. The MLAPI has added it");

0 commit comments

Comments
 (0)