Players can't see each other when changing scene with PhotonNetwork.LoadLevel

Options

Hello Everyone! I'm working on my project and faced with this issue:

1. Players are joined to the room and can see each other... Player A and Player B

2. Then if a Player A goes to another scene with PhotonNetwork.LoadLevel() Player B still can see him at the initial scene

3. If a Player B goes to another scene to Player A they cant see each other, even when they are back to initial scene

Thanks

Answers

  • Almaz
    Almaz
    edited October 2022
    Options

    public override void OnJoinedRoom()

      {

        PhotonNetwork.LoadLevel("Lobby");

      }


    Then another code block to transfer a player:


    PhotonNetwork.LoadLevel(LOBBY_TAG);

    DontDestroyOnLoad(other);

  • Make sure you set this property to true:

     PhotonNetwork.AutomaticallySyncScene = true;// sync scene for all players

    and make sure the players have PhotonView component.

    then,

    There are two ways to sync player movement

    Method 1: use Photon Transform View component, and if the player has animation and RigidBody.. use Photon Animator View and Photon RigidBody View..

    Method2 : Use IPunObservable, check the documentation for more details in how to use IPunObservable

  • Almaz
    Options

    Scenes are changing perfectly, the issue is that players firstly can see each other at initial scene but then can't see each other on the other scenes, that is the issue

  • Tobias
    Options

    Only the Master Client should load any scenes. If your clients always load some specific scene on join, then you overrule what AutomaticallySyncScene is supposed to do.