Quantcast
Channel: Recent Discussions — Photon Engine
Viewing all articles
Browse latest Browse all 15755

Updating character equipment

$
0
0
I am trying to sync character look across server. I have some client sided functions that sets the gear according to it's logged in character. What im struggling with is updating the look of that character across all clients. I have it now so it sets your character but you cannot see the proper look on the other client and vice versa. I wrote a function (RPC) which I thought would do the trick but apparently isn't. Is RPC's the best way of going about this? Or could custom properties be more efficient. I have been stuck on this for some time and it's really holding me back. Im looking for a bit on insight as to why what i'm doing isn't working and how I can make it work. Any help is appreciated.

My Code regarding setting player equipment.

I locally set the equipment after instantiation then call this RPC.

equipment.GetComponent ().RPC ("UpdateCharacterEquipmentOnServer", PhotonTargets.Others);

[PunRPC]
public void UpdateCharacterEquipmentOnServer(PhotonMessageInfo info)
{
NetworkCharacter myCharacter = GetComponent ();

Debug.Log (myCharacter.CharacterName);

foreach (int equip_id in myCharacter.EquipmentIds)
{
if (equip_id != 0)
{
SetEquipment(EquipmentIndex.GetEquipmentById(equip_id));
}
}
}


My thinking with this was that because i locally set gear, then call this RPC to other clients, it would set their gear on my instance to display what they really have on,

Thanks,
Dev.

Viewing all articles
Browse latest Browse all 15755

Trending Articles