- Home /
Unity Photon 2 only master client can see others players
Hi, I'm trying to create a multiplayer game with photon 2. When players enter the room, only the master client can see the other players, the others can't. Below is an example screenshot. How can I fix this?**
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
public class SpawnPlayers : MonoBehaviourPunCallbacks
{
public Vector3 spawnPlayers;
// Start is called before the first frame update
protected private void Start()
{
spawnPlayers = GameObject.FindGameObjectWithTag("SpawnPalyers").transform.position;
Spawn();
}
protected private void Spawn()
{
PhotonNetwork.Instantiate("Player", spawnPlayers, Quaternion.identity);
}
}
unless you add relevant code to explain what you are doing noone will be able to tell..
Answer by miha4406jp · Sep 23, 2021 at 04:54 PM
Players use network instantiate? They have PV component? If you use existing game objects with PV component attached they will not synchronize automatically.
Initially the player enters the hobby and can create or join in a room. Once in a room, my player is instantiated with PhotonNetwork.Instantiate and he has a photon view component. Please hep me because i am really frustrated.
the most relevant code parts would be how and where you actually call the isntantiate calls. Can you add this as well?
there is also a code formatting button (the one with the numbers above the text input for your posts) which allows you to properly add code to your posts without the need to upload images.
Done. I added the very simple spawn players script.
So, 1st client enters the room and creates game object immediately? Then 2nd player joins, he doesn't see this game object? Correct? Then, maybe, problem appears because it's instantiated in absence of this 2nd player. You may need manual instantiation (https://doc.photonengine.com/en-us/pun/current/gameplay/instantiation#manual_instantiation). Or you can use RPC to standard instantiate, but send it to RpcTarget.AllBuffered, so joined clients execute it too.
I'm not sure, though. Because i'm always waiting for all clients to join, and only then start anything.
Your answer
![](https://koobas.hobune.stream/wayback/20220613043407im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Unity Photon 2 only master client can see others players 0 Answers
Client side prediction, rigidbody.velocity, photon network 0 Answers
Photon SceneObject Creating by Client 0 Answers
Photon Instantiate object not disappear after dc master client 0 Answers
set otherplayer as master client when master client leaves room photon 1 Answer