com.unity.netcode.gameobjects icon indicating copy to clipboard operation
com.unity.netcode.gameobjects copied to clipboard

Cancelling client's connection results in scene network objects to be destroyed

Open NaolShow opened this issue 1 year ago • 0 comments

Description

It seems that a regression occured between the version v1.7.1 and v1.8.0 (reproductible up until the v1.9.1) that affects the scene network objects.

When starting a client connection (to an unreachable IP to test the bug) and then cancelling the connection with NetworkManager.Shutdown(true or false) will result in ALL the scene network object to be destroyed. Those objects do not reappear after connecting/hosting again.

Reproduce Steps

  1. Create a random network object in a scene
  2. Connect as a client in the same scene
  3. Cancel the connection

Actual Outcome

The scene network object is destroyed from the scene

Expected Outcome

The scene network object should stay in the scene, only be resetted for the next time when hosting or connecting again as a client

Environment

  • Unity Version: 2022.3.11f1
  • Netcode Version: v1.8.0 all the way up to v1.9.1 (did not try on develop branch)

Additional Context

Regression must have come from one of the commits made between the v1.7.1 and v1.8.0: https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/compare/release/1.7.1...ngo/1.8.0

I'll try to crawl through the problem when I'll have time.

EDIT: Quick check leads to the culprit which is this commit: https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/commit/7ab9947497f39fe2d966f70822718845de5d8436

NaolShow avatar May 08 '24 00:05 NaolShow