OnPlayerDisconnected

var playerPrefab:Transform;

function OnPlayerConnected()
{
	var newTransform=Network.Instantiate(playerPrefab,transform.position,Quaternion.identity,0);	
}

function OnPlayerDisconnected(player:NetworkPlayer)
{
	print(player.ipAddress);
	Network.DestroyPlayerObjects(player);
}

function OnDisconnectedFromServer(info:NetworkDisconnection)
{
	Application.LoadLevel(Application.loadedLevel);
}

What makes me confused is that when a player disconnected from server the function OnDisconnectedFromServer would execute and destory playerobjects of the disconnected player ,but the playerobjects of the disconnected player are still there when i test ,they are not destroyed.Why?

Same problem here, looking into it now

ok not sure how you got your setup going but this seems to work for me so far:

function OnPlayerDisconnected(player:NetworkPlayer) {
	
	if(player == NETWORK_PLAYER){
		
		Network.RemoveRPCs(gameObject.networkView.viewID);
        Network.Destroy(gameObject);
        
	}
    
}

The player is created by the server in my case so it works. Also I have a local NetworkPlayer on the game object.

var playerPrefab:Transform;

function OnPlayerConnected()

{

    var newTransform=Network.Instantiate(playerPrefab,transform.position,Quaternion.identity,0);    

}

OnPlayerConnected() is only called by the server and if the server instantiates the playerPrefab, the server is the owner not the player, means the Player has no objects associated to him so

function OnPlayerDisconnected(player:NetworkPlayer)

{

    print(player.ipAddress);

    Network.DestroyPlayerObjects(player);

}

wont delete anything. You could either let the client instantiate the prefab, then the above would work or destroy it by the viewId/gameObject like superme.