Skip to content

Unity serialization exception from NetworkConnection constructor after upgrading to Mirror 96.11.3 #4130

Description

@lcompton

Description

After upgrading Mirror from 96.11.2 to 96.11.3, I began getting repeated Unity serialization exceptions involving NetworkConnection.

Downgrading to Mirror 96.11.2 eliminates the exceptions without any other code changes.

Environment

  • Unity: 6000.6.3f1
  • Mirror: 96.11.3
  • Last known working Mirror version: 96.11.2

Exception

UnityException: get_time is not allowed to be called during serialization, call it from Awake or Start instead. Called from MonoBehaviour 'NetworkIdentity' on game object 'Player'.
See "Script Serialization" page in the Unity Manual for further details.
Mirror.NetworkConnection..ctor () (at Assets/Mirror/Core/NetworkConnection.cs:65)
Mirror.NetworkConnectionToClient..ctor () (at Assets/Mirror/Core/NetworkConnectionToClient.cs:63)
UnityEngine.StackTraceUtility:ExtractStringFromExceptionInternal(Object, String&, String&)

Network prefab registration

One potentially relevant detail is that I do not maintain the network prefab list manually in the NetworkManager inspector.

My network prefabs are loaded as Addressables and registered programmatically using:

NetworkClient.RegisterPrefab(networkIdentity.gameObject);

This worked without the serialization exceptions under Mirror 96.11.2.

Reproduction / regression

I believe the following steps will reproduce the issue, although I haven't verified...

  1. Create a project using Unity 6000.6.3f1.
  2. Install Mirror 96.11.3.
  3. Create a prefab with a NetworkIdentity.
  4. Create a script that registers the prefab with NetworkClient.RegisterPrefab().
  5. get_time is not allowed to be called during serialization exception occurs.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions