I have a Level File...which contains the following code. Once a player disconnects from the Server, An RPC is called on all clients to delete their temporary data. I always get an exception on the server
"View ID AllocatedID: 151 not found during lookup. Strange behaviour may occur" and "Couldn't perform remote Network.Destroy because the network view 'AllocatedID: 151' could not be located."
I don't see where I went wrong...specifically cause this is the code from the documentation w/out the extra RPC.
What is wrong with this code? Is there a better way to do this?
thanks, stringa // --- Called On the Server
public void OnPlayerDisconnected(NetworkPlayer player)
{
// --- This is called before the LevelManager.PlayerDisconnectedFromServer
Debug.Log("Clean up after player " + player);
PlayerData data = GameData.Instance.GetPlayer(player);
if(data != null)
{
networkView.RPC("RemovePlayerData", RPCMode.AllBuffered, data.PlayerID);
}
Network.RemoveRPCs(player);
Network.DestroyPlayerObjects(player);
}
[RPC]
void RemovePlayerData(int playerID, NetworkMessageInfo info)
{
PlayerStats ps = GameData.Instance.RemovePlayer(playerID);
if(ps != null)
{
GameData.Instance.LevelManager.DeadPlayers.Add(ps);
}
}