You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Photon Bolt:创建后如何设置房间为私有?

Fixing Private Room Setup with BoltLauncher.StartSinglePlayer

Got it, I’ve run into this exact issue before when setting up private online sessions with Bolt. Let’s walk through the correct steps to lock your room so unwanted players can’t join—just setting IsOpen = false isn’t always enough on its own.

1. Combine IsOpen and IsVisible for Full Privacy

When creating your session, you need to set both IsOpen and IsVisible to false. Here’s why:

  • IsOpen = false blocks new players from joining even if they know your room ID.
  • IsVisible = false hides the room from all public lobby listings entirely.

If you only set IsOpen = false, players who already have your room ID might still be able to connect in some edge cases (depending on Bolt’s network layer configuration). Pairing both settings closes that loophole.

2. Add a Session Password (Extra Security Layer)

For an added barrier, set a password on your session. This ensures even if someone somehow gets your room ID, they can’t join without the correct password. Here’s how to implement this with StartSinglePlayer:

// Create a custom session configuration
var sessionData = new SessionCreationData();
sessionData.IsOpen = false;
sessionData.IsVisible = false;
sessionData.Password = "your-private-password-here"; // Replace with your unique password
sessionData.Name = "My Private Online Session"; // Optional: Name your room for clarity

// Start the single-player host with this locked-down config
BoltLauncher.StartSinglePlayer(sessionData);

3. Check for Accidental Setting Overrides

Double-check your codebase for any places where you might be overwriting the room’s IsOpen or IsVisible values after calling StartSinglePlayer. For example, some lobby UI scripts or late-stage network initialization logic might reset these settings without you noticing.

4. Verify the Room State

After starting the host, confirm your settings are applied by checking Bolt’s runtime logs (look for lines about session creation) or by accessing the session directly:

if (BoltNetwork.Session != null)
{
    Debug.Log($"Room IsOpen: {BoltNetwork.Session.IsOpen}");
    Debug.Log($"Room IsVisible: {BoltNetwork.Session.IsVisible}");
    Debug.Log($"Room Has Password: {!string.IsNullOrEmpty(BoltNetwork.Session.Password)}");
}

If these logs don’t match your intended settings, you’ll know there’s a piece of code overriding them somewhere.

5. Use a Stable Bolt Version

Occasionally, older versions of Bolt had bugs related to session visibility and join permissions. If all the above steps don’t work, make sure you’re on the latest stable release of Bolt—this can resolve unexpected behavior.


内容的提问来源于stack exchange,提问作者user13337231

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.08 19:02:43