Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Third Party [PUN2/VR] Going from room-scene to room-scene

Discussion in 'Multiplayer' started by PascalTheDog, Mar 9, 2022.

  1. PascalTheDog

    PascalTheDog

    Joined:
    Mar 16, 2015
    Posts:
    86
    Hey,

    I'm working on a VR multiplayer game with a three-scene flow: the starting chamber, the collective lounge and the play arena. The latter two are associated with their own rooms.

    The starting chamber scene is not multiplayer: it deals purely with player preparation and calibration; from then on, their avatar remains persistent across rooms-scenes. When all's done, it connects to the server and loads the collective lounge room and the associated scene. In here, players can see each other and make decisions about how they're going to play. Once everyone is ready, it loads the player arena and the associated scene. At least that's how it goes in my mind. Of course, some player can join later and find themself alone in the lounge, from which they can join the ongoing match in the play arena if they so wish.

    The way Photon PUN is designed, you can't hop from room to room; you need to be on the master server to create or join a room. So what I do when I want to switch room-scene is leave the current room, then use callbacks to load the next room and the associated scene when I'm back on the master server. Well, that's what I'm trying to achieve right now.

    Is this good practice? Or am I missing an essential piece of the puzzle? Assistance would be greatly appreciated. Cheers!
     
    Last edited: Mar 9, 2022
  2. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,076
    You could also use Interest Groups to separate the two areas within the same room. This would not fully separate them though and the lounge would be per-room.
    If you wanted the lounge to be another room entirely then use the approach you described: Leave lounge and JoinOrCreateRoom on the Master Server to get into a separate room/game.
     
  3. PascalTheDog

    PascalTheDog

    Joined:
    Mar 16, 2015
    Posts:
    86
    I see. Thanks!
     
    tobiass likes this.