Sending RPC failed?

Ok so I have bin programing a multiplayer TPS (expected FPS did we?), and everything has bin going pretty
good so far. But now I am at a part of my multiplayer code where I keep getting the same error that makes
no sense to me;

Sending RPC failed because ‘ApplyDamage’ parameter 0 didn’t match the RPC declaration. Expected ‘System.Object’ but got ‘System.Single’
UnityEngine.NetworkView:RPC(String, RPCMode, Object[ ])
shooter:Fire() (at Assets/scripts/shooter.js:65)
shooter:Update() (at Assets/scripts/shooter.js:40)

Now in my mind this should be simple, do a raycast (bullet if you will) and send a RPC to the player I hit;

hit.transform.gameObject.networkView.RPC("ApplyDamage", RPCMode.All, damage);

Thus calling;

@RPC
function ApplyDamage(damage){
	health -= damage;
	if(health <= 0.0)
		Die();
}

But it never calls “ApplyDamage” because “‘ApplyDamage’ parameter 0 didn’t match the RPC declaration”.
So can someone please tell me what I am doing wrong here? Or maybe give a link to somewhere that can help me out?

Only 2 hours into 2011 and I seem to have fixed. It appears that I have gotten to used to short handing everything, and I just had to change;

@RPC
function ApplyDamage(damage){
	health -= damage;
	if(health <= 0.0)
		Die();
}

To;

@RPC
function ApplyDamage(damage : float){
	health -= damage;
	if(health <= 0.0)
		Die();
}

Yup thats right I missed something as simple as that. But at least I can take comfort in knowing that if anyone else gets the same error the can learn from my mistake (it’s so much easier the other way around lol).

Only 2 years 10 months later but this got me out of trouble … :smile: