Search Unity

Third Party PHOTON: PhotonNetwork.LoadLevel() vs. SceneManager.LoadScene()

Discussion in 'Multiplayer' started by Peteroid69, Feb 19, 2022.

  1. Peteroid69

    Peteroid69

    Joined:
    Nov 11, 2018
    Posts:
    36
    is the main difference between LoadLevel() and LoadScene() that LoadLevel() loads the scene for all players (and must be done by the Master Client)... while LoadScene() only does it for the Player calling it?

    in general... what is the difference between the two ways to get to another Scene.. and when in general should one be used over the other?
     
  2. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,072
    PhotonNetwork.LoadLevel is the networked version of loading scenes.
    If you want to use it, set PhotonNetwork.AutomaticallySyncScene to true in your code (for all clients), then the Master Client can switch scenes with PhotonNetwork.LoadLevel and everyone else (in the room) will follow along. Late joiners included.
     
  3. AleNavarro

    AleNavarro

    Joined:
    Dec 30, 2016
    Posts:
    7
    Hi tobiass.

    If I have a game where I want people to join and meet in a specific scene, but I do not want a Master client to drag them, can I simply use PhotonNerwork.LoadLevel with AutomaticallySyncScene disabled?

    Thanks a lot.
     
  4. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,072
    If you have networked scene objects, this is tricky. You want to avoid getting updates for these objects if they are not known/loaded yet. If you don't use the automatic approach, you have to take care of the timing. It's possible but we can't help beyond showing you what to look out for.
     
  5. wobuqidai

    wobuqidai

    Joined:
    Aug 1, 2019
    Posts:
    2
    If “PhotonNetwork.AutomaticallySyncScene=false”,loads the scene with “SceneManager.LoadScene”,How does the client synchronize the scene?
     
  6. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,072
    It doesn't. You disabled it.
    You can use RaiseEvent or other communication options to let everyone in the room know which scene to load, if you like. Reminder: Take care of the timing (as linked above)...
     
  7. ahmad1477

    ahmad1477

    Joined:
    Mar 14, 2019
    Posts:
    1

    how to use RaiseEvent or other communication options to let everyone in the room know which scene to load