fgamez1020
fgamez10202mo ago

Room Join

How can I just join the first available room with out having a code?
3 Replies
kapa.ai
kapa.ai2mo ago
Hi @fgamez1020. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- To join the first available room without specifying a room code in Normcore, you can use the Connect() method with a randomly generated or predefined room name. Here's how you can do it: 1. Use the Realtime.Connect() method, providing a room name of your choice. All clients connecting to the same room name will end up in the same room server. 2. You can generate a random room name or use a predefined one. For example:
private void Start() {
// Get the Realtime component
Realtime realtime = GetComponent<Realtime>();

// Connect to a room with a predefined or randomly generated name
string roomName = "DefaultRoom"; // or generate a random name
realtime.Connect(roomName);
}
private void Start() {
// Get the Realtime component
Realtime realtime = GetComponent<Realtime>();

// Connect to a room with a predefined or randomly generated name
string roomName = "DefaultRoom"; // or generate a random name
realtime.Connect(roomName);
}
This approach will connect you to the specified room, creating it if it doesn't exist or joining an existing one if it does. It's important to note that Normcore doesn't have a built-in concept of "first available room". Each room is identified by its name, and rooms are created on-demand when clients connect to them Realtime API (https://normcore.io/documentation/realtime). If you want more control over the connection process, you can use the ConnectOptions parameter:
realtime.Connect(roomName, new Room.ConnectOptions {
// Add any additional options here
});
realtime.Connect(roomName, new Room.ConnectOptions {
// Add any additional options here
});
Remember that room names in Normcore are namespaced to your App Key, so different apps using the same room name will connect to different rooms Realtime (https://normcore.io/documentation/realtime/realtime). For more detailed information on connecting to rooms, you can refer to the Room documentation (https://normcore.io/documentation/room/room). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@1053407831916822528> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Mechabit
Mechabit2mo ago
use unity lobby or any other lobby plugin

Did you find this page helpful?