-
Notifications
You must be signed in to change notification settings - Fork 464
Description
Describe the bug
With one or more clients connected to a host, all remote clients throw a NullReferenceException when the host calls Shutdown().
To Reproduce
- Start a host.
- Wait for the host's server to start.
- Connect a client to the host.
- Wait for the client to connect.
- Run NetworkManager.Singleton.Shutdown() on the host.
- In the client's console output, notice a NullReferenceException entry.
Actual outcome
After the host is shutdown, connected clients are disconnected, and an error is logged in each client's console. The host does successfully shutdown. The client does successfully disconnect from the server.
Expected outcome
The client should cleanly disconnect from the server without an error message.
Screenshots
https://user-images.githubusercontent.com/2303421/140042480-001892be-6e73-4a59-9739-cd91d1be1254.mp4

Environment (please complete the following information):
- OS: Windows 11
- Unity Version: 2021.2.0f1
- Netcode Version: 1.0.0-pre.3
- Netcode Commit: 3e4df72
Additional context
I experience the issue while using UNetTransport and default inspector settings for both the NetworkManager and UNetTransport.
Attached is a project to reproduce the issue(NullRefReprod.zip). Make two copies of the project. Open ReprodScene and click Play in both copies. In the first project, click button "1. Start Host." In the second project, click button "2. Join Host @ 127.0.0.1:7777." Once the client has joined the host, click button "3. Shutdown" in the host project. Now the client will disconnect and log a NullReferenceException.