Received RPC error

I have a Turret and Units they shoot against each other. But if one of the Devices faster in the calculating he killed the Units first ... it means the Health are not sync
Received RPC "NetworkHealth" for viewID 2001 but this PhotonView does not exist! Was remote PV. Owner called.
UnityEngine.Debug:LogError(Object)
NetworkingPeer:ExecuteRPC(Hashtable, PhotonPlayer) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1838)
NetworkingPeer:OnEvent(EventData) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1643)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[])
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:76)
public void AddjustCurrentHealth (float adj)
	{
		view.RPC("NetworkHealth",PhotonTargets.All,adj);
	}

	[RPC]
	void NetworkHealth(float adj){
		curHealth -= adj;	
		maxHealth = upgrade.getHealthUpdate(healthLvl);
		if (curHealth < 0)		
			curHealth = 0;	
		if (curHealth > maxHealth)		
			curHealth = maxHealth;		
		if(maxHealth < 1)		
			maxHealth = 1;		
		healthBarLength = curHealth /(float)maxHealth;
	}

Comments

  • But if one of the Devices faster in the calculating he killed the Units first ... it means the Health are not sync
    This may happen if you calculate health on each client. You should calculate it once (on owner client e.g.) and notify others about new value or destroy object.
  • aaah yeah okay i try it thx