Closed BartoszBieszka closed 1 year ago
Maybe is problem with Netcode 1.2.0 version. I have the same problem on SteamNetworkingTransport. Before update Netcode that code work perfectly. After downgrade to 1.1.0 error disappear
Also having this issue. ^_^
Edit: Thinking maybe have to check for null reference of .connection ?
By chance are you starting the network manager in host mode? I'm using netcode for gameobjects v1.2.0 as well and encountered this issue when starting and then shutting down a host.
I believe the issue is this: with netcode for gameobjects 1.2.0, when started as a host, the transport's StartClient
method is not called by the network manager, but DisconnectLocalClient
eventually is when shutting down. That's inconsistent with the steam transport's logic. The transport assumes that serverUser
is initialized when connecting to a client, so it shouldn't be null when a connected client calls DisconnectLocalClient
. However in this case serverUser
never gets initialized and is null when accessed in DisconnectLocalClient
.
NullReferenceException: Object reference not set to an instance of an object. Netcode.Transports.SteamNetworkingSocketsTransport.DisconnectLocalClient () (at Library/PackageCache/com.community.netcode.transport.steamnetworkingsockets@e9f53f86a0/Runtime/SteamNetworkingSocketsTransport.cs:63) Unity.Netcode.NetworkManager.ShutdownInternal () (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Core/NetworkManager.cs:1446) Unity.Netcode.NetworkManager.OnNetworkPostLateUpdate () (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Core/NetworkManager.cs:1652) Unity.Netcode.NetworkManager.NetworkUpdate (Unity.Netcode.NetworkUpdateStage updateStage) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Core/NetworkManager.cs:1538) Unity.Netcode.NetworkUpdateLoop.RunNetworkUpdateStage (Unity.Netcode.NetworkUpdateStage updateStage) (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Core/NetworkUpdateLoop.cs:185) Unity.Netcode.NetworkUpdateLoop+NetworkPostLateUpdate+<>c.b__0_0 () (at Library/PackageCache/com.unity.netcode.gameobjects@1.2.0/Runtime/Core/NetworkUpdateLoop.cs:268)
Tried NetworkTransport.Shutdown(); and NetworkManager.Singleton.Shutdown(); and nothing happen, still receiving error