Reproduction steps:
1) Add NetworkServerSystem, TransportServerSystem, DistanceInterestManagementSystem to Server
2) Add NetworkClientSystem, TransportClientSystem, SpawnMessageSystem, UnspawnMessageSystem to Client
3) Start the Server
4) Connect with the Client
5) Instantiate a prefab with a NetworkIdentity from the prefab manager on the server
6) Spawn it on the server with authority given to the client (this will also spawn it on the server)
7) Instantiate a prefab with a NetworkIdentity from the prefab manager on the server (without spawning it)
8) The entity with netid==0 will be spawned on the client
If there is trouble reproducing the issue I can add a reproduction project (omitting the DOTSNET package)
Edit: Adding this here from my discord message
I would suggest adding a Spawned component to entities that have been spawned on the server. This makes it more clear what NetworkServerSystem.Spawn() actually does (since the actual spawn messages are created by an InterestManagementSystem).
NetworkServerSystem.Spawn would add the Spawned component, and NetworkServerSystem.Unspawn would remove it. This would also make it easier to iterate over only spawned entities as the components would be linearly laid out in memory and make better use of cache levels. InterestManagementSystems would then only iterate over entities with the Spawned component. It would also make it easier to only look at spawned entities in the entity debugger on the server world, as spawned and non-spawned entities would be in separate archetypes.
Reproduction steps: 1) Add NetworkServerSystem, TransportServerSystem, DistanceInterestManagementSystem to Server 2) Add NetworkClientSystem, TransportClientSystem, SpawnMessageSystem, UnspawnMessageSystem to Client 3) Start the Server 4) Connect with the Client 5) Instantiate a prefab with a NetworkIdentity from the prefab manager on the server 6) Spawn it on the server with authority given to the client (this will also spawn it on the server) 7) Instantiate a prefab with a NetworkIdentity from the prefab manager on the server (without spawning it) 8) The entity with netid==0 will be spawned on the client
If there is trouble reproducing the issue I can add a reproduction project (omitting the DOTSNET package)
Edit: Adding this here from my discord message
I would suggest adding a
Spawned
component to entities that have been spawned on the server. This makes it more clear whatNetworkServerSystem.Spawn()
actually does (since the actual spawn messages are created by anInterestManagementSystem
).NetworkServerSystem.Spawn
would add theSpawned
component, andNetworkServerSystem.Unspawn
would remove it. This would also make it easier to iterate over only spawned entities as the components would be linearly laid out in memory and make better use of cache levels.InterestManagementSystems
would then only iterate over entities with theSpawned
component. It would also make it easier to only look at spawned entities in the entity debugger on the server world, as spawned and non-spawned entities would be in separate archetypes.