Description
I additively load a scene (and I am using Netcode's scene management). In that scene file there is a GameObject at the root with a NetworkObject and this script:
usingUnityEngine;usingUnity.Netcode;usingUnityEngine.SceneManagement;publicclassWarnTest:NetworkBehaviour{publicNetworkObjectspawnPrefab;protectedoverridevoidOnNetworkPostSpawn(){if(NetworkManager.IsServer){NetworkObjectchildNetObj=GameObject.Instantiate(spawnPrefab,transform.position,transform.rotation);SceneManager.MoveGameObjectToScene(childNetObj.gameObject,gameObject.scene);childNetObj.Spawn(destroyWithScene:true);childNetObj.TrySetParent(transform);}}}The prefab I spawn is the simplest case... just a prefab with a NetworkObject. This prefab is in a manually created network prefab list that I have set in my NetworkManager.
This results in two warnings:
[Netcode] Trying to spawn a NetworkObject with a NetworkObjectId of 109 but an object with that id is already in the spawned list. This should not happen!
[Netcode] [null][Deserialize][NetworkBehaviourSynchronization][Size mismatch] Expected: 122 Currently At: 121!
(Please note that the second warning will cause a NullException without a patch fix applied for #4071)
Am I forgetting some rule about parenting or about spawning? What is the issue here? I'm not seeing my mistake in the docs.
Environment
- OS: Windows
- Unity Version: 6000.3.16f1
- Netcode Version: 2.12.0 (although certainly not a new problem to this version)
- Netcode Topology: Client-Server
Description
I additively load a scene (and I am using Netcode's scene management). In that scene file there is a GameObject at the root with a NetworkObject and this script:
The prefab I spawn is the simplest case... just a prefab with a NetworkObject. This prefab is in a manually created network prefab list that I have set in my NetworkManager.
This results in two warnings:
[Netcode] Trying to spawn a NetworkObject with a NetworkObjectId of 109 but an object with that id is already in the spawned list. This should not happen![Netcode] [null][Deserialize][NetworkBehaviourSynchronization][Size mismatch] Expected: 122 Currently At: 121!(Please note that the second warning will cause a NullException without a patch fix applied for #4071)
Am I forgetting some rule about parenting or about spawning? What is the issue here? I'm not seeing my mistake in the docs.
Environment