Skip to content

Commit 06ce0ad

Browse files
committed
feat: Added exception messaging when accessing NetworkedBehaviour without object
1 parent c8e91d1 commit 06ce0ad

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

MLAPI/Core/NetworkedBehaviour.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ public NetworkedObject NetworkedObject
107107
{
108108
_networkedObject = GetComponentInParent<NetworkedObject>();
109109
}
110+
111+
if (_networkedObject == null)
112+
{
113+
throw new NullReferenceException("Could not get NetworkedObject for the NetworkedBehaviour. Are you missing a NetworkedObject component?");
114+
}
115+
110116
return _networkedObject;
111117
}
112118
}

0 commit comments

Comments
 (0)