Search Issue Tracker

Won't Fix

Votes

0

Found in [Package]

1.9.1

2.0.0-exp.2

Issue ID

NCCBUG-234

Regression

No

The server is trying to spawn an additional GameObject when spawning a GameObject owned by the client

Package: Multiplayer Netcode for GameObjects

-

How to reproduce:
1. Open the “NetcodeRepro“ project
2. Open the “OutdoorScene“
3. Build and Run
4. In the Player click on the “Server“ button
5. Navigate back to the Editor
6. Enter the Play Mode
7. Open the “DontDestroyOnLoad > NetworkManager“ GameObject in the Inspector
8. Click on the “Start Client“ button in the Network Manager Component
9. Observe the Console window

Expected result: No warnings are thrown in the Console
Actual result: “Trying to spawn NetworkObjectId 2 that already exists!“ warning thrown in the Console

Reproducible with: 1.9.1 (2022.3.31f1, 6000.0.5f1), 2.0.0-exp.2 (6000.0.5f1)
Could not test with: 1.9.1 (2021.3.39f1) (Could not resolve the HDRP errors)

Reproducible on: macOS 13.5.2 (Intel), Windows 10 (User’s)
Not reproducible on: No other environments tested

Notes: The issue also reproduces when both client and server are opened from the Player

  1. Resolution Note:

    Remove the portion of the player script that has the server spawn the player object when the player object is spawned as this is done automatically for you. The reason it is complaining about the object being spawned twice is that it is being spawned again on the server side when the player prefab is automatically spawned in the Player script.

    If you want to spawn a custom network prefab per player, review over the Changing the player Prefab section in the NGO documentation.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.