I have a script that is supposed to run 4 RPC calls using RPCMode.All. All 4 of the functions are called correctly on the local player but only 3 are called on the same player on the rest of the network. I have no idea why it is behaving this way. Here is some code…
protected virtual void Fire()
{
// update firing rate
m_NextAllowedFireTime = Time.time + ProjectileFiringRate;
//play fire sound
if (SoundFireDelay == 0.0f) {
networkView.RPC ("PlayFireSound", RPCMode.All); //PlayFireSound();
}
// spawn projectiles
if (ProjectileSpawnDelay == 0.0f){
networkView.RPC ("SpawnProjectiles", RPCMode.All);//SpawnProjectiles();
}
// spawn shell casing
if (ShellEjectDelay == 0.0f){
networkView.RPC ("EjectShell", RPCMode.All);//EjectShell();
}
// show muzzle flash
if (MuzzleFlashDelay == 0.0f){
networkView.RPC ("ShowMuzzleFlash", RPCMode.All); //ShowMuzzleFlash();
}
}
[RPC]
protected virtual void PlayFireSound()
{
Debug.Log ("Play Sound");
}
[RPC]
protected virtual void SpawnProjectiles()
{
Debug.Log ("Spawn Projectile");
}
[RPC]
protected virtual void ShowMuzzleFlash()
{
Debug.Log ("Muzzle Flash");
}
[RPC]
protected virtual void EjectShell()
{
Debug.Log ("Spawn Shell");
}
The RPC that doesnt fire correctly on the rest of the network is EjectShell().
Thank you for any suggestions you have.