RPC won't accept valid parameters

Hi everyone,

im currently having a problem which block my path to the release of my game: While trying to execute this RPC

@RPC
function dmg (qte : float, target3 : playercore){
	target3.TakeDamage(Mathf.Round(qte));
}

with the command

	if(Physics.Raycast(transform.position,avant,hit) && Time.fixedTime > tt + 0.1){
		if(hit.transform.GetComponent(playercore) != null){
			latestcore = hit.transform.GetComponent(playercore);
			core.DealDamage(1 * Bank.plcore.mgmult,latestcore);
			Debug.Log("gotplayercore");
		}
		tt = Time.fixedTime;
		Debug.Log("gotgameobject");
	}

to execute this function

function DealDamage (amount : float, target : playercore) {
	if(networkView.isMine){
		networkView.RPC("dmg",RPCMode.All,amount * dmgmult,target);
	}
}

but the game send me back

Sending RPC failed because 'dmg' parameter 1 (playercore) is not supported.
UnityEngine.NetworkView:RPC(String, RPCMode, Object[])
playercore:DealDamage(Single, playercore) (at Assets/playercore.js:168)
MachineGun_lan:Update() (at Assets/MachineGun_lan.js:35)

the latestcore var is a playercore type, why its not working? :frowning:
Thank you

You cannot send your own types via RPC.
As written in the docs, the only valid parameter types for RPC are int, float, string, NetworkPlayer, NetworkViewID, Vector3 and Quaternion.
However, although not documented, an RPC can also receive a byte array, which bypasses the 4096 character limit on string parameters.

If you want to send your own custom type you’ll have to serialize it into either a string format (think JSON/XML) or binary format, and parse it on the other end.