I use Playfab and Photon for my Unity project. I added some weapons, shields and body types to my player prefab and disabled all of them (except the head). I store which weapon, shield and body type the user have, and pull them from playfab when the player logs in. But the problem is, I can see my own weapon, shield and body but cannot see other player's. I can only see their heads! I assume that it is because when other user joins the scene, their prefab instantiates with PhotonNetwork but SetActive method is working for individuals, not for the server. Here is my code:
public override void OnJoinedRoom()
{
s = "PlayerArmature(Clone)/";
if(PFLogin.prefabName=="Female"){
gameObject = PhotonNetwork.Instantiate(playerPrefabFemale.name, new Vector3(73, 22, 34), Quaternion.identity, 0,null);
s = "PlayerArmatureF(Clone)/";
s += "FemaleCharacterPolyart/";
view = playerPrefabFemale.GetComponent<PhotonView>();
}else{
gameObject = PhotonNetwork.Instantiate(playerPrefab.name, new Vector3(73, 22, 34), Quaternion.identity, 0,null);
s += "MaleCharacterPolyart/";
view = playerPrefab.GetComponent<PhotonView>();
}
GameObject body = GameObject.Find(s+PFLogin.body);
GameObject cloak = GameObject.Find(s+PFLogin.cloak);
GameObject shield = GameObject.Find(s+"root/pelvis/spine_01/spine_02/spine_03/clavicle_l/upperarm_l/lowerarm_l/hand_l/weapon_l/"+PFLogin.shield);
GameObject weapon = GameObject.Find(s+"root/pelvis/spine_01/spine_02/spine_03/clavicle_r/upperarm_r/lowerarm_r/hand_r/weapon_r/"+PFLogin.weapon);
body.SetActive(true);
cloak.SetActive(true);
shield.SetActive(true);
weapon.SetActive(true);
if (view.IsMine)
{
view.RPC("ShowMesh", RpcTarget.AllBuffered, s);
}
}
void ShowMesh(string s)
{
GameObject body = GameObject.Find(s+PFLogin.body);
GameObject cloak = GameObject.Find(s+PFLogin.cloak);
GameObject shield = GameObject.Find(s+"root/pelvis/spine_01/spine_02/spine_03/clavicle_l/upperarm_l/lowerarm_l/hand_l/weapon_l/"+PFLogin.shield);
GameObject weapon = GameObject.Find(s+"root/pelvis/spine_01/spine_02/spine_03/clavicle_r/upperarm_r/lowerarm_r/hand_r/weapon_r/"+PFLogin.weapon);
body.SetActive(true);
cloak.SetActive(true);
shield.SetActive(true);
weapon.SetActive(true);
}
PFLogin is a static class which stores static variables(body&weapon etc) that are assigned with playfab responses.
So my question is how can I call SetActive(true) such that everyone see others bodys(or other things).
At first I've tried without RPC and all I see was heads without bodies in the screen, now I've tried with RPC but nothing changed. It could be my lack because I am very new to all of this.
I would try to use the isMine to make every prefab active:
I hope it helps, I have never done it like you did, so I am