Studio GuideWorld SDK Guide
Log In

Set up in Private Room Runtime

You can change the multiplayer Room attribute at runtime.

❗️

Caution

  • This feature is available in version 1.9.0 and above of ZEPETO World Package.
  • Please create the server code index.ts Sandbox.

Function definition

SetPrivate(isPrivate : boolean) : Promise - True : Set to private room
- False : Set to public room

Example of use

import { Sandbox, SandboxOptions, SandboxPlayer } from 'ZEPETO.Multiplay';

export default class extends Sandbox {
    
    onCreate(options: SandboxOptions) {
        this.onMessage("SetPrivate", (client: SandboxPlayer, value: boolean) => {
            console.log(`Try Set Private : ${value}`);
            this.setPrivateRoom(client, value);
        });
    }
    
    async setPrivateRoom(client: SandboxPlayer, value: boolean) {
        await this.setPrivate(value);
        client.send("Log", `Room Set Private : ${this.private}`);
    }
}

👍

Difference between lock and private functions

  • The locked multiplayer room is not visible in the ZEPETO room list and cannot be entered by invitation.
  • Private multiplayer rooms are not shown in the list of ZEPETO rooms, but invitations are acceptable.