-
Notifications
You must be signed in to change notification settings - Fork 457
Closed
Labels
stat:importedStatus - Issue is tracked internally at UnityStatus - Issue is tracked internally at Unitytype:featureNew feature, request or improvementNew feature, request or improvement
Description
Description
OnNetworkSpawn()
is not called on NetworkBehaviours under these circumstances:
- If Reload Scene and Reload Domain are disabled -
OnNetworkSpawn
will not be called just for the first time after scripts reload. - If Reload Scene is disabled and Reload Domain is enabled -
OnNetworkSpawn
will not be called at all.
Reload Scene and Reload Domain are under the enter play mode settings in Projects Settings > Editor.
Reproduce Steps
- Add this script to a GameObject with a NetworkObject component:
using UnityEngine;
using Unity.Netcode;
public class Test : NetworkBehaviour
{
public override void OnNetworkSpawn()
{
Debug.Log("OnNetworkSpawn() called");
}
}
- Disable Reload Scene and/or Reload Domain in enter play mode settings.
- Enter play mode
- Start host
Actual Outcome
The message "OnNetworkSpawn() called" doesn't appear due to OnNetworkSpawn()
not being called. If you disabled both Reload Scene and Reload Domain, the message will appear if you enter mode again without reloading scripts. If you disabled just the Reload Scene the message won't appear at all.
Expected Outcome
The message should appear in the console window.
Environment
- OS: Windows 11
- Unity Version: 2021.3.0f1
- Netcode Version: 1.0.0-pre.7
Metadata
Metadata
Assignees
Labels
stat:importedStatus - Issue is tracked internally at UnityStatus - Issue is tracked internally at Unitytype:featureNew feature, request or improvementNew feature, request or improvement