Description
The function OnNetworkDespawn() on server side is not called when a client leave the game or call the NetworkManager.Singleton.Shutdown() function.
Normaly, OnNetworkDespawn() should be call on server and client :
https://docs-multiplayer.unity3d.com/netcode/current/api/Unity.Netcode.NetworkBehaviour/index.html
In the version 0.1.0 this bug wasn't existing.
Reproduce Steps
- Create a new project (the bug has been tested on 2021.3.13.f1 and 2021.2.8f1)
- Create a new gameobject "Network" and add a NetworkManager component and a Unity Transport Component (the bug has also been tested with UNet transport)
- Create a script "BuggyPlayer" that inherit from NetworkBehaviour and write the function "public override void OnNetworkDespawn()", add a Debug.Log("Despawn"); in it
- Create a Prefab "Player", and add Network Object Component and your BuggyPlayer component
- Drag and drop your prefab in the NetworkManager component in the inspector
- Create a script "DummyHUD" then create 3 functions "void HostServer()", "void JoinServer()", "void ShutdownNetwork()", and call in HostServer function "NetworkManager.Singleton.StartHost();" in JoinServer "NetworkManager.Singleton.StartClient();" and in ShutdownNetwork "NetworkManager.Singleton.Shutdown();".
- Add your DummyHUD component to the gameobject "Network"
- create 3 buttons and link them to each of the functions from DummyHUD
- Make a build
- Start server on the editor then click your button linked to the HostServer function
- Launch a client (which you have just built) and click on your button linked to the JoinServer function
- Check that the scene has 2 Player(clone) in the hierarchy (that means that the client is correctly connected)
- Click on the client the button linked to "ShutdownNetwork" or close the client (both give the same result)
Actual Outcome
You will see that there is no output "Despawn" in the console of the server side.
Expected Outcome
The output "Despawn" should be visible in the consol on the server side (by the way it is visible on client side)
Environment
- OS: Windows 11
- Unity Version: 2021.3.13.f1 and 2021.2.8f1
- Netcode Version: 1.1.0
Description
The function OnNetworkDespawn() on server side is not called when a client leave the game or call the NetworkManager.Singleton.Shutdown() function.
Normaly, OnNetworkDespawn() should be call on server and client :
https://docs-multiplayer.unity3d.com/netcode/current/api/Unity.Netcode.NetworkBehaviour/index.html
In the version 0.1.0 this bug wasn't existing.
Reproduce Steps
Actual Outcome
You will see that there is no output "Despawn" in the console of the server side.
Expected Outcome
The output "Despawn" should be visible in the consol on the server side (by the way it is visible on client side)
Environment