Network views wrong on re join to server

The clients in my game need to have net ownership of targets to prevent lag on their simulation of physics objects. (So they can be shootable and behave in a realistic manner)

This works. When a player occupies an area, they assume net ownership of the objects in that area. I accomplish that by allocating new network view id’s from the players side, then sending all of those view ID’s via an RPC call. Groovy.

My problem comes in when a client disconnects. When a client quits via their GUI, they first call an RPC to return net ownership to the server:

On Client:

if (GUILayout.Button("Yes") )

	Game.m_pInstance.networkView.RPC("ReturnNetOwnershipOfStation", RPCMode.AllBuffered,  m_pOwner.m_pEmbodiedSpawnPoint.m_iIndex);

On Server:

	public void ReturnNetOwnershipOfStation(int pSpawnPointIndex)
		if (!Network.isServer)
			return; // Only want server to take action here

		Debug.Log("Returning ownership of spawn index " + pSpawnPointIndex + " back to server");

		SpawnPoint Station = SpawnPoint.GetSpawnPointByIndex(pSpawnPointIndex);
		for (int i = 0; i < Station.m_pOwnedTargets.Count; ++i)
			GameObject subObj = Station.m_pOwnedTargets*.GetComponentInChildren<NetworkView>().gameObject;*
  •  	NetworkViewID newViewID = Network.AllocateViewID();*
  •  	networkView.RPC("UpdateGameObjectsNetworkViewID", RPCMode.AllBuffered, subObj.networkView.viewID, newViewID);*
  •  }*
  • }*
    I get a runtime error saying: Couldn’t send RPC function ‘UpdateGameObjectsNetworkViewID’
    Furthermore, when that same client re joins the server, the server spouts off a magnitude of errors looking like this:
    View ID AllocatedID: 300 not found during lookup. Strange behaviour may occur
    Received state update for view id’ AllocatedID: 300’ but the NetworkView doesn’t exist
    Every time the client re joins, the network view ID’s that they see increase by about 100. (ie they rejoin again, they get ID’s in the 400 range)
    What could be causing these ID’s to be out of sync, and increment them like this on joining the server again?


I managed to fix this with a sledgehammer approach by saying each client that joins receives the list of all network ID’s that the server see’s and manually sets them so they sync up