The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on Realtime.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Cant see players which are already joined.

Freel4tte
2011-10-23 18:50:34

I am making a multi player game and now I'm testing it with the Angry Bots Photon demo stripped down to the player model. I already made a login screen, a lobby and a level. When I host a game I join the level and run around and shoot into oblivion and I can see other players who join later then me. But every player who joins next cant see the players already connected before him.

Unity gives the error about Photon id's that are 1000 and over and that such PhotonVIew dont even exist. Is this the cause of the problem or is it something else. And how do I make this work?

Help is really appreciated and thanks in advance!

Comments

Tobias
2011-10-24 08:48:05

Hm, as much as I'd like to dive into debugging this, I can't. Once you modified the projects so heavily, we can't really support everyone.

Most likely you modified some prefab or gameobject which had a script or PhotonView somewhere. You should probably take a look at the Viking Demo or at the Worker Demo. Both have just the essentials in and comparing those with your project might help you identify the broken spot.

Freel4tte
2011-10-24 11:35:39

Thanks for your reply! But generally speaking, what is wrong with wich script when players can't see each other?

dreamora
2011-10-24 14:36:04

you don't buffer the previous instantiations for example so newly connected players are not informed about players already in the game. Thats the most common error basically that leads to this.

Tobias
2011-10-24 15:47:04

Maybe you use GameObject.Instantiate() instead PhotonNetwork.Instantiate()? Then the views are not created on all clients.

Freel4tte
2011-10-24 18:11:06

@dreamora wrote:

you don't buffer the previous instantiations for example so newly connected players are not informed about players already in the game. Thats the most common error basically that leads to this.

Sorry to be a pain in the ass, but where can I find these bufferings. I tried to look for myself but its kind of hard for me to understand it all. It's really important for me to get this fixed so that's why i'm asking so much. :? Thanks for your reply tough!

dreamora
2011-10-24 18:13:23

PhotonNetwork.Instantiate buffers it automatically, same goes for RPCs you send with xxxBuffered as PhotonTarget anything else is not buffered and new players won't know about it at all unless you resent the RPCs etc to them.

Tobias
2011-10-25 08:36:19

Again: Please check your code if you accidentally used GameObject.Instantiate() instead PhotonNetwork.Instantiate()? Then the views are not created on all clients and you don't see others. Buffering of instantiations is done for you. I just wanted to explain the background.

Freel4tte
2011-10-25 11:09:42

@Tobias wrote:

Again: Please check your code if you accidentally used GameObject.Instantiate() instead PhotonNetwork.Instantiate()? Then the views are not created on all clients and you don't see others. Buffering of instantiations is done for you. I just wanted to explain the background.

I checked it and its PhotonNetwork.Instantiate GameObject GO =PhotonNetwork.Instantiate(playerPrefab, transform.position, Quaternion.identity, 0); Sorry for not answering your reply.

Tobias
2011-10-26 15:16:34

Hmm. Then I don't really see how this should happen. Could you provide a minimized package which shows the issue or attach the important code?

Freel4tte
2011-10-28 07:42:56

I don't understand the minimized package part, but I can add the Gamemanager code (I think it's the important code).

Hope this helps!

Freel4tte
2011-10-28 10:51:48

I have found the thing that made this happen. When I join a room, the Awake part in the GameManager scripts gets activated and Instantiates a playerprefab. But it Instantiates while the login scene is still loaded. So when the game scene is loaded the already Instantiated player is already spawned in the script, but nowhere to be seen in the scene.

My recent solution was to use a GUI.Button to instantiate the playerprefab. I waited untill both players where in the game scene, then clicked the button and both where instantiated in both the players scene's.

Thanks for all your help!

DKReigns
2019-05-06 05:39:38

I have a similar problem. I managed to solved it by creating a GameManager handler and monitors each time a player enters a room. When someone does, it will "refresh" the instance of all players inside. This is similar to @Freel4tte's solution. You can use

public override void OnPlayerEnteredRoom(Photon.Realtime.Player newPlayer)

God bless and happy coding! :smile:

DKReigns
2019-05-06 05:41:41

I use Photon PUN 2 btw.
I know this thread is very old but maybe some newer viewers who are also having the sample problem could stumble upon this thread, so I'll just leave my answer here.

:smile:

M4rCOS
2020-02-08 12:45:20

Hello! I had the same problem and I found out that I was loading my Play scene with SceneManager.LoadLevel instead of PhotonNetwork.LoadLevel.

I know it's a dumb thing but it worked in my case.
Perhaps someone else will be in the same situation so remember to check for this.

Happy coding! :)

Llaarryy
2021-03-11 17:49:59

Hey @M4rCOS

I guess you'll never see this but just in case I wanted to tell you that you just made my day. I was soo frustrated.
Thank you so much, you're awesome!

ButterGuy
2021-05-18 04:04:27

@Freel4tte could you help explain how you fixed it as in showing the code maybe?

ButterGuy
2021-05-18 04:16:05

@DKReigns Was there anything to input within brackets after putting that or did it work alone?

AssassinSquidGames
2022-01-20 03:51:08

@M4rCOS THANK YOU!!!! I was so lost. I'm glad it only took me an hour and a half to find this

Back to top