question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

In-Scene NetworkObjects get destroyed if NetworkManager shuts down while not fully connected (e.g. failed connection attempt)

See original GitHub issue

Describe the bug Any NetworkObjects living in a scene (or even DDOL) will get destroyed if during connection attempt, it fails or it gets cancelled.

To Reproduce Steps to reproduce the behavior:

  1. Add a GameObject with a NetworkObject (Don’t Destroy With Owner = true) component to a scene.
  2. Setup a NetworkManager with UNet’s transport.
  3. Start the scene in Play Mode.
  4. Start the NetworkManager as client, but don’t let it connect to a server.
  5. Shut down the NetworkManager.

Actual outcome The GameObject holding the NetworkObject is destroyed.

Expected outcome The GameObject holding the NetworkObject should only be despawned and it should eventually be destroyed when the scene is unloaded, not before.

Environment (please complete the following information):

  • OS: Windows 10
  • Unity Version: 2020.3
  • Netcode Version: 1.0.0-pre.5

Additional context During the connection attempt, the NetworkManager is in the following state: IsClient = true, IsConnectedClient = false. Every NetworkObjects are not yet spawned (IsSpawned = false).

Then, a NetworkManager Shutdown is done (because the connection attempt is cancelled or timed out).

NetworkManager’s ShutdownInternal method is invoked, which then invokes NetworkSpawnManager’s DespawnAndDestroyNetworkObjects method which - since those in-scene NetworkObjects aren’t spawned yet - fall into its else case which Object.Destroy them.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ashwinimurtcommented, Feb 20, 2022

@WhippetsAintDogs There seems to be an internal problem that prevented creating the Issue tracker for this particular bug. I have requested the customer QA teams to fix and have it created. I understand that not being able to easily search for an issue is a concern. We will discuss with the team. Thank you for the feedback.

0reactions
WhippetsAintDogscommented, Mar 18, 2022

Fixed in pre.7

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolved - Disconnecting as a client
Hello, In my game, when a match ends, a client RPC is called that ... Destroy a spawned NetworkObject on a non-host client...
Read more >
Changelog | Netcode for GameObjects | 1.2.0
(#1811); Fixed in-scene NetworkObjects get destroyed if a client fails to connect and shuts down the NetworkManager.
Read more >
NetworkManager keeps connecting and disconnecting. ...
The fix To fix this I simply disabled ipv6 connections, for both wifi and ethernet cable connections, in the nm-applet network manager gui...
Read more >
Last upgrade crashes network manager (no internet ...
While upgrading today, something caused my wireless network manager to disappear. Not even connecting via wired connection. This error is being ...
Read more >
[SOLVED] Wifi hotspot not working: activition of connection ...
So I checked NetworkManager status when starting the hotspot, and got the following: sudo systemctl status NetworkManager.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found