using System.Collections;using System.Collections.Generic;using UnityEngine; - Pastebin.com At line 63, I check if i’m in a room, which I am. If I am in a room, I will leave that room in line 65. Then at line 70, I check if i’m not in a room which i’m not anymore because I left the room at line 65. The problem is, it wont return true/it won’t debug line 71. Why won’t it return true if I left the room in line 65?
Joining and leaving rooms are “network actions”, if you will. As the server needs to do something for you, it will take a moment to get from state to state.
You should base your workflow on the callbacks PUN provides. When you call Join*(), wait for OnJoinedRoom(). When you call Leave(), PUN will return to the Master Server and OnJoinedLobby() or OnConnectedToMaster() are called when PUN is ready.
All callbacks are in a PunBehaviour for your convenience:
http://doc-api.exitgames.com/en/pun/current/class_photon_1_1_pun_behaviour.html
Check out the Basics Tutorial and other docs, too:
1 Like
If you’re in a room, and i joined another room, that would put me in the new room. So do i need to leave room to switch rooms?
What a question lol, Of course.