Skip to content

SpawnWithObservers set to false, but network object spawns on later joined clients #2680

@lunatic198413

Description

@lunatic198413

Description

SpawnWithObservers set to false, but network object spawns on later joined clients

Reproduce Steps

  1. Load TestProject from this repository
  2. In Scene located at path Scenes/SampleScene in game object [NetworkManager] disable chekbox Enable Scene Manager
  3. In player prefab PlayerCube located at path Prefabs/PlayerCube in component NetworkObject disable chekbox SpawnWithObservers
  4. Save and build project with only current scene selected in build window
  5. Start three instance of built application
  6. Click Create server in first application (server)
  7. Click Join Game in second application (client_1)
  8. Click Join Game in third application (client_2)

Actual Outcome

Client_1 have one spawned player object of client_1
Client_2 have two spawned player objects of client_1 and client_2

Expected Outcome

Clients 1 and 2 have no spawned objects on the scene.
Second client should not see the player object of the first client, because the first client's player object has the SpawnWithObservers parameter set to false

Screenshots

image

Environment

  • OS: [Windows 11]
  • Unity Version: [2022.3.8]
  • Netcode Version: [1.5.2]

Additional Context

Possible problem is in class ConnectionApprovedMessage line 48
image

I think you should add check of SpawnWithObservers property, like this:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:highThis issue has high priority and we are focusing to resolve itstat:importedStatus - Issue is tracked internally at Unitytype:bugBug Report

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions