mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
fix: Added null check and error logging to OnDeserializeAllSafely
This commit is contained in:
parent
a0f5a846d7
commit
b86c8615f4
@ -1005,6 +1005,15 @@ void OnDeserializeSafely(NetworkBehaviour comp, NetworkReader reader, bool initi
|
||||
|
||||
internal void OnDeserializeAllSafely(NetworkReader reader, bool initialState)
|
||||
{
|
||||
if (NetworkBehaviours == null)
|
||||
{
|
||||
Debug.LogError($"NetworkBehaviours array is null on {gameObject.name}!\n" +
|
||||
$"Typically this can happen when a networked object is a child of a " +
|
||||
$"non-networked parent that's disabled, preventing Awake on the networked object " +
|
||||
$"from being invoked, where the NetworkBehaviours array is initialized.", gameObject);
|
||||
return;
|
||||
}
|
||||
|
||||
// deserialize all components that were received
|
||||
NetworkBehaviour[] components = NetworkBehaviours;
|
||||
while (reader.Remaining > 0)
|
||||
|
Loading…
Reference in New Issue
Block a user