I’m attempting to use an RPC call to send damage information to the other player in a 2 player Network game. However, I’m a bit confused on how to get the “Receiver” to acknowledge the change:
@RPC
function GiveDamage(hitDamage : float)
{
Network.Instantiate(hitPrefab, Vector3(selectedEnemy.transform.position.x, 1.7, selectedEnemy.transform.position.z), Quaternion.identity, 0);
networkView.RPC ("selectedEnemy.GetComponent(playerObject).TakeDamage", RPCMode.All, hitDamage);
//selectedEnemy.GetComponent(playerObject).TakeDamage(hitDamage);
}
The commented out line works on the local machine (and the damage is taken, etc), but on the other players machine, nothing changes. The networkView.RPC
line is taken from the RPC instructions, but I think I’m confused how to specify the object that is to receive the instructions to run the function. (http://docs.unity3d.com/Documentation/Components/net-RPCDetails.html)
Any ideas?