Photon RPC problem...

ive got this error: PhotonView with ID 5001 has no method “EquipItemShared” that takes 1 argument(s): String

That is my script:

if(GUILayout.Button ("Equip"))
									{
							
										//Load the item.
										
										callEquipItem(PhotonTargets.Others,lastitemPressed.GetComponent<I_info>().itemName);
										
										if(photonView.isMine)
										equipItem(lastitemPressed.GetComponent<I_info>().itemName);
										
}


_________________________________________________________



	void equipItem(string itemNameShared)

    {
		//Will quip the selected item.
		GameObject weaponUsed=PhotonNetwork.Instantiate(itemNameShared,GetComponent<P_combat>().handBone.transform.position,GetComponent<P_combat>().handBone.transform.rotation,0);
		weaponUsed.transform.parent=GetComponent<P_combat>().handBone.transform;
		GetComponent<P_combat>().equippedWeapon=weaponUsed;
    }
	
	[RPC]
	
    void EquipItemShared(PhotonMessageInfo info, string NameShared)
    {
        if(info.sender.ID != PhotonNetwork.player.ID)
        {//Will show item equipment for other players.
        equipItem(NameShared);
        }   
    }

    

    void callEquipItem(PhotonTargets target,string itemNameShared)
    {//Will call "Fire" for the given targets.
        photonView.RPC("EquipItemShared",target,itemNameShared);
    }

It happends when I press the equip button as you see.

Photon RPCs can take a PhotonMessageInfo parameter as the last parameter in the method. You have it as the first. Try switching your parameters around and take a look at this:

Have a good day!

RPC is a method you call from a network view, not a script.

You need to attach a network view component to the game object containing the script.

Have a look at the documentation.

Your target needs a network view too, with this script attached too (it needs to know the
“EquipItemShared” method too).

try PhotonPlayer targetPlayer instead of PhotonTargets target.
i don’t know but I used this in mine and it works.