ParelVRDocs
Player site

Creators / Worlds

Subrooms

Several scenes in one world, one instance, one download.

A world can be more than one scene. Every enabled scene in File > Build Profiles uploads with the world, in the same file. Players arrive in MainScene; a script moves a player into another scene, a subroom, with VoltScene.Switch.

  • Nothing downloads. The subroom comes from the world's file the player already has.
  • Same instance. Players in a subroom are still in the instance: friends can join them, and the instance's player count includes everyone in every subroom.
  • Each room is its own space. Players in another subroom are not shown or heard until you are in the same one, and going between subrooms does not announce "joined" or "left".

Set it up#

  1. Open File > Build Profiles and add your scenes to the scene list. One of them must be called MainScene.
  2. Give each subroom its own ParelVR Spawn Point. That is where players land when they switch in. Without one they arrive where MainScene's spawn point is.
  3. Call VoltScene.Switch from a script, for example from a door:
using ParelVR.Volt;
using ParelVR.Volt.Scene;

public class SubroomDoor : VoltBehaviour
{
    public string scene = "Basement";

    public override void OnInteract()
    {
        VoltScene.Switch(scene);
    }
}

VoltScene.Switch("MainScene") goes back. Switching moves only the local player: put the call where that player's own action is (an interaction, their own trigger), not in code that runs on every client.

  1. Publish from MainScene. The other scenes build with it.

Errors the SDK shows#

Message Fix
You need a "MainScene". Fix this by renaming 1 of your scenes to MainScene. Rename the scene players arrive in to MainScene and add it to Build Profiles.
"Lobby" isn't in Build Profiles. Add the open scene to the scene list in File > Build Profiles.
Open "MainScene" to build and publish. Publish with MainScene open.
You're calling "Basement", but "Basement" isn't in Build Profiles. A script calls VoltScene.Switch("Basement") and there is no scene by that name in Build Profiles. Add it, or fix the name.

The last check covers names written in quotes. A name that comes from a variable is checked when the script runs: the same message appears in the script console and nothing happens.

Scripts in subrooms#

  • A scene's scripts run while the player is in it. Leaving a subroom stops them; coming back starts them fresh.
  • VoltWorld.Players and VoltWorld.PlayerCount are the players in your subroom. VoltInstance.PlayerCount counts everyone in the instance.
  • Synced variables, network events and ownership are shared only with players in the same subroom. Its master is the instance master when they are in it, otherwise the player who has been in the instance longest.
  • In Play Mode, VoltScene.Switch swaps the playing scene for the subroom and starts its scripts, so you can walk through your whole world.