/// <summary> /// Initializes the room api. /// </summary> void InitRoomApi() { // If we have a room, we'll join the first room we see. // If we are the user with the lowest user ID, we will create the room. // Otherwise we will wait for the room to be created. if (roomManager.GetRoomCount() == 0) { if (LocalUserHasLowestUserId() && Time.frameCount > 1500) { Debug.Log("Creating room "); // Keep the room open even when all users have left the shared session. // This will allow us to persist an anchor in the same room on the sharing service. currentRoom = roomManager.CreateRoom(new HoloToolkit.Sharing.XString("DefaultRoom"), roomID, true); CurrentState = ImportExportState.InitialAnchorRequired; } } else { Debug.Log("Joining room "); currentRoom = roomManager.GetRoom(0); roomManager.JoinRoom(currentRoom); CurrentState = ImportExportState.RoomApiInitialized; } if (currentRoom != null) { Debug.Log("In room :" + roomManager.GetCurrentRoom().GetName().GetString()); } }
/// <summary> /// Initializes the room api. /// </summary> void InitRoomApi() { // If we have a room, we'll join the first room we see. // If we are the user with the lowest user ID, we will create the room. // Otherwise we will wait for the room to be created. if (roomManager.GetRoomCount() == 0) { if (LocalUserHasLowestUserId()) { Debug.Log("Creating room "); // To keep anchors alive even if all users have left the session ... // Pass in true instead of false in CreateRoom. currentRoom = roomManager.CreateRoom(new XString("DefaultRoom"), roomID, false); currentState = ImportExportState.InitialAnchorRequired; } } else { Debug.Log("Joining room "); currentRoom = roomManager.GetRoom(0); roomManager.JoinRoom(currentRoom); currentState = ImportExportState.RoomApiInitialized; } if (currentRoom != null) { Debug.Log("In room :" + roomManager.GetCurrentRoom().GetName().GetString()); } }