Networking Destroy Player's RPC function uhm WHAT?

ok the Q may be seem trivial to you but I just started learning networking I don’t understand aloot.

I was starting to trying to figure out how to give each player a specific class when he logs in and so and how to destroy that class he “owns” on server and stuff like that, … but I’ve run in to the documentation witch turned my head around (like I understood gravity but now I don’t any longer), …


Been reading this 2 manuals:

  • Network.OnDisconnectedFromServer

  • Network.OnPlayerDisconnected

    using UnityEngine;
    using System.Collections;

    public class Example : MonoBehaviour {
    void OnPlayerDisconnected(NetworkPlayer player) {
    Debug.Log("Clean up after player " + player);
    Network.RemoveRPCs(player);
    Network.DestroyPlayerObjects(player);
    }
    }

well I’ve figure out I’ll probably need OnPlayerDisconnected since I was searching for:

[RPC]
	void SomeFunction (NetworkMessageInfo Info){
	}

so I would somehow figure out how to determen witch class to destroy, …

BUT as far as I knew the:

  • client was sending RPC functions to server
  • server was verifying if server knows that exact RPC functions and executed them

but now I’m reading:

Network.RemoveRPCs(player);

so what does it do?:

  • connects back to client and deletes the functions I’ve wrote on client? kinda highly unlikely, …
  • Deletes the RPC functions on the server to witch server has access since client has disconnected and deletes them so other clients cannot use them any longer?
  • OR even more strange thing to reverse the process and calculates the WHOLE thing how else would physics go if that player wouldn’t do any RPC calls, …

like the title says uhm WHAT?, … it puts all the logic I understand on the head, …

the second thing if there’s a function call:

Network.DestroyPlayerObjects(player);

how do I tell that function what objects ARE the objects this particular client has? or will it delete everything this client has touched meaning half of my HDD with him, …

I’m sorry this documentation totally confuses me and puts all my logic on the head, … can some one turn it back on please, … OR my head will start to hurt, …

No one truly knows how Unity’s networking works; I answered this question with how I think Unity determines object ownership and not everyone agreed with me…

Basically, I believe the server keeps track of all connected players, what objects they’ve created and what RPCs they’ve sent. (This is also the reason everyone sees the server as the owner of all network.instantiated objects, unless the player himself instantiated it.)

I would imagine that the server just keeps a data structure of all RPCs and Objects instantiated by everyone. Calling Network.RemoveRPCs(player); just clears all buffered RPCs from that data structure so the server doesn’t send them to any newly connected player. Conversely, calling Network.DestroyPlayerObjects(player); just destroys the GameObjects that are Network.Instantiated by player on each client. So basically the server just does something similar to networkView.SendRPC("Destory",RPCMode.All,listOfObjects);