Changing weapons via RPC and PhotonNetwork

Hey guys i am working on a multiplayer game right now and suddenly there are some troubles stopping me from what i want… I want to change my weapons via RPC call and i get some annoying Errors :frowning: so this is my code :

` public void ChangeWeapon(Weapon newWeapon)
{

		GetComponent<PhotonView>().RPC("ChangeWeapon_RPC",PhotonTargets.All,newWeapon.gameObject,weaponPos );
		currentWeaponGO=PhotonView.Find(viewID).gameObject;
}

[RPC] public void ChangeWeapon_RPC (GameObject newWeapon,Transform weaponPos){

	GameObject weaponGo;
	weaponGo = (GameObject)Instantiate(newWeapon,weaponPos.position,weaponPos.rotation);	
	weaponGo.transform.parent = weaponPos.transform;
	viewID = weaponGo.GetComponent<PhotonView> ().viewID;

}

}`

Help would be great ! thanks :slight_smile:

RPC calls don’t accept game objects as arguments.

See the doc HERE.