Open AsmPrgmC3 opened 1 month ago
@AsmPrgmC3 Indeed this does look like a bug and we need to make sure our integration tests includes testing server only. Unless you are using overrides for your prefabs, you can set forceOverride to true and it should when running as a server:
using Unity.Netcode;
using UnityEngine;
[RequireComponent(typeof(NetworkObject))]
public class Spawner : NetworkBehaviour
{
public NetworkObject prefab;
public override void OnNetworkSpawn()
{
if (!IsServer)
{
return;
}
NetworkManager.SpawnManager.InstantiateAndSpawn(prefab, forceOverride: true);
NetworkManager.SpawnManager.InstantiateAndSpawn(prefab, forceOverride: true);
}
}
This would be a temporary work around until the next update. The fix for this is pretty simple so I am going to go out on a limb and say the fix will be in the next update (whatever version we end up with that proceeds v1.9,1).
Thank you for the detailed information! 👍
Description
SpawnManager.InstantiateAndSpawn
doesn't instantiate the prefab when run on a server.Reproduce Steps
[RequireComponent(typeof(NetworkObject))] public class Spawner : NetworkBehaviour { public NetworkObject prefab;
}