Instantiate Remote Object

Hi,

I am spawning an object on my local player (through an inventory system), and I need it to appear for the remote player. I am able to call it up on my local player, but it won't appear on my remote. I'd really appreciate any help or advice.
Here's what I'm doing.

To keep things brief, I'll just summarize my first function (which I'm calling "SendPhotonEquip") here. This gathers information on the object in the local player's hand, and fills in variables on this script that is observed by the Photon View. This passes it on to the next function, "PhotonEquip" (which is an RPC), which is called up on the remote player.

I think the problem lies is how I'm calling up these functions.

This is how I'm sending off the info to PhotonEquip() from SendPhotonEquip():

thisObjectsPhotonView.RPC("PhotonEquip", RpcTarget.OthersBuffered);

Now on the function that gets called up by the remote player, PhotonEquip, here's what I'm doing:



[PunRPC]
public void PhotonEquip()
{ //This is supposed to actually create the item on the remote player.

if (!thisObjectsPhotonView.IsMine)
{
//Here we check to see if the Weapon variable is actually filled in (that's all handled in SendPhotonEquip). If not, then don't bother.
if (lWeaponTemp != null)
{
//Here we simply instantiate the object into the scene. Note that it has to have a photon view on it.
GameObject lWeaponObject = Resources.Load(lPath);
(Instantiate(lWeaponObject, lWeaponPosTemp, lWeaponRotTemp) as GameObject).transform.parent = lWeaponParent.transform;
}
}





Do I need to get rid of the if statement checking ThisObjectsPhotonView? I think I have tried it without it (also tried if(thisObjectsPhotonView.IsMine==false)), but still wasn't getting it to appear on the remote. Any idea what I'm doing wrong? Thanks in advance.

This discussion has been closed.