Players are getting loaded but the scenes are not synched.

I am not sure what the problem is and how to describe it but when I have two players in the same scene it is as if they are two different scenes.

Images to show problem.


two different players on the same scene but for some reason the gameobjects/assets on one players screen is not shown on the others.


I already have PhotonNetwork.AutomaticallySyncScene = true; so im not sure what the problem is.

Answers

  • There are a lot of exceptions. Those prevent the execution of code that would be run after the exception, so .. this is the first thing to fix. We can't help with that, though, unless our code has these exceptions...

    Sorry. Can't help unless it's really about PUN.

  • Oh alright I thought this was about PUN because PhotonNetwork.AutomaticallySyncScene = true; didnt seem to be working could you give me an example of what the exceptions could come from.

  • could you give me an example of what the exceptions could come from.

    This is visible in the callstack in the console / log.

    That's a topic I can not help with, because it's basic Unity. In the Unity forum, you can hopefully find advice to debug this (this sort of issues in general).

  • Alejandrazo
    edited August 2022

    PlayerPrefab have photonview and photon transform view?

    Maybe you are instantiating 2 player prefabs for each player.

  • Yes PlayerPrefab does have photonview and photon transform view.

    I am not instantiating 2 player prefabs for each player I'm pretty sure.


  • No there are no current exceptions that would prevent the exeution of code.

  • Hm. Try this: Only the Master Client should PhotonNetwork.LoadLevel. The other players should skip this (and automatically sync the scene based on the Master Client's selection).

  • Yeah I already had done this, it seems as if they are in the same scene but for every new player that joins the room there seems to be another instance of all the gameobjects for the players.

  • Man, this seems to be tricky.

    At this point, I would recommend doing a test project instead. Skip everything you did now to just get the basics working. Use the ConnectAndJoinRandom component to get into a room. Run one script in the scene and on joined, instantiate. You should first instantiate a prefab you made from a Cube with a PhotonView on it. Not a single thing more.

    If that works, work up from there. Add components to the prefabs. Add scripts as needed. Figure out where the issue is.

  • Alright will do thanks for the help.