#KcpTransform Problem / Host problem

13 messages · Page 1 of 1 (latest)

arctic jewel
#

Hello everyone. I don't have much experience with Mirror and I've encountered an issue I can't seem to solve. I've implemented local multiplayer in my project, and the problem is that when I press the Stop Host and Stop Server buttons, the player prefab gets destroyed, but things such as the Camera remain present. When I press the Start Host button again to create a new session, the previous Camera is still present on the scene. Additionally, there's an error in the console regarding KcpTransport:

NullReferenceException: Object reference not set to an instance of an object
kcp2k.KcpTransport.<Awake>b__29_3 () (at Assets/Mirror/Transports/KCP/KcpTransport.cs:119)
kcp2k.KcpClient.OnDisconnected () (at Assets/Mirror/Transports/KCP/kcp2k/highlevel/KcpClient.cs:86)
kcp2k.KcpPeer.Disconnect () (at Assets/Mirror/Transports/KCP/kcp2k/highlevel/KcpPeer.cs:743)
kcp2k.KcpTransport.ClientDisconnect () (at Assets/Mirror/Transports/KCP/KcpTransport.cs:178)
Mirror.NetworkClient.Shutdown () (at Assets/Mirror/Core/NetworkClient.cs:1720)
Mirror.NetworkManager.OnClientDisconnectInternal () (at Assets/Mirror/Core/NetworkManager.cs:1306)
Mirror.NetworkClient.OnTransportDisconnected () (at Assets/Mirror/Core/NetworkClient.cs:419)
Mirror.LocalConnectionToServer.Disconnect () (at Assets/Mirror/Core/LocalConnectionToServer.cs:111)
Mirror.NetworkClient.Disconnect () (at Assets/Mirror/Core/NetworkClient.cs:245)
Mirror.NetworkManager.StopClient () (at Assets/Mirror/Core/NetworkManager.cs:672)
Mirror.NetworkManager.StopHost () (at Assets/Mirror/Core/NetworkManager.cs:604)
Mirror.NetworkManagerHUD.StopButtons () (at Assets/Mirror/Core/NetworkManagerHUD.cs:140)
Mirror.NetworkManagerHUD.OnGUI () (at Assets/Mirror/Core/NetworkManagerHUD.cs:45)

Despite following the instructions and guides correctly, asking ChatGPT, and conducting research on the internet, I'm completely unsure how to solve this problem.

feral marten
#

With KCP the devs need to help you

#

As for the camera, you should resolve other errors, especially "Can't destroy Transform" error.
Pass gameObject of the transform you want to destroy to Destroy method.

#

If it's from Mirror, then again. You needs devs help.

tight wasp
#

KCP error is from asset store Mirror i am guessing.
its fixed in github version
(backup project, remove old mirror, import mirror package from github)

#

And yes the camera stuff is all covered in quickstarted guide and mirror/examples

#

see what they do for reference 🙂

#

@arctic jewel

arctic jewel
# feral marten As for the camera, you should resolve other errors, especially "Can't destroy Tr...

These issues are not a problem. I've already fixed them in the main version of the project. In the main version, I encountered the KCP error, and since I couldn't find a solution, I rolled back to the previous commit without multiplayer and decided to add Mirror from scratch, step by step, checking at which stage this KCP error appears. Eventually, I realized that it occurs immediately after adding Mirror, simply masked by less significant errors. When I resolved the minor issues, I once again encountered the KCP error, just like in the main version.

#

But nevertheless, thank you for the response.