Network.DestroyPlayerObjects not destroying anything

I’ve been trying to wrap my head around Unity networking for a couple hours now, I’ve been using both Leepo’s zero to hero tutorial and the networking examples from Unity3d.com’s resources.

I have a basic connection working, where it network.instantiates a player prefab on a spawn point for both the server and the player that connects, and I’m limiting the control script on the player prefab based on NetworkView.isMine… which works fine.

But I’m trying to use Network.DestroyPlayerObjects in OnPlayerDisconnected, using a snippet from the docs… but it isn’t doing anything, so all the prefabs that were instantiated when the server connected and any clients connected still linger around.

Here is my code:

NetworkSpawn.js

var playerPrefab : Transform;

function OnServerInitialized(){
	Network.Instantiate(playerPrefab, transform.position, transform.rotation, 0);
}

function OnConnectedToServer(){
	Network.Instantiate(playerPrefab, transform.position, transform.rotation, 0);
}

function OnPlayerDisconnected (player : NetworkPlayer){
	Debug.Log("Server destroying player");
	Network.RemoveRPCs(player);
	Network.DestroyPlayerObjects(player);
}

PlayerNetworkInit.js

function OnNetworkInstantiate (msg : NetworkMessageInfo) {

	if (networkView.isMine){
		Camera.main.SendMessage("SetTarget", transform);
	}
	else{
		GetComponent("FPSInputController").enabled = false;
	}
	
}

(sorry for necro) I’m having a similar problem, it appears that the buffer is still keeping hold of the player, so while the server will destroy the object for connected clients, if a client reconnects they see all of the ‘destroyed’ objects.

Fixed it, for some reason DestroyPlayerObjects doesn’t work quite right unless you also specify group number.

I see the exact same problem, and I don’t see how you can pass a group to the DestroyPlayerObjects method. How exactly did you fix this?

Same problem, no player objects getting destroyed

SAME PROBLEM GOD DAMN IT, useless function

Fixed: My guess: Network.DestroyPlayerObjects is called with RPCMode.Others or sth similar
I had to manually destroy the objects on each page ( Server or Client )

PS: unitys docu sucks hard :stuck_out_tongue_winking_eye: