기술 자료

지원

Lobby

Lobby

로비 데이터 업데이트

Modify lobby data and properties to reflect changes in game state or session configuration.
읽는 시간 1분최근 업데이트: 한 달 전

로비 호스트는 로비 데이터를 업데이트할 수 있는 유일한 플레이어입니다. 다른 플레이어는 보기 옵션에 따라 읽을 수 있는 데이터가 다릅니다(로비 데이터 및 플레이어 데이터 참고). 로비 레벨 데이터가 활용되는 방법은 다음과 같이 다양합니다.
  • 공개 인덱싱된 로비 프로퍼티는 쿼리 필터에서 기준과 일치하는 로비를 찾는 데 사용될 수 있습니다.
    • 예를 들어 게임에서 커스텀 공용의 인덱싱된 프로퍼티로 ‘game mode’를 사용할 수 있으며 플레이어는 쿼리에서 ‘game mode = foo’를 검색하여 기준과 일치하는 로비를 찾을 수 있습니다.
  • 멤버 전용 로비 프로퍼티는 호스트가 설정할 수 있으며, 모든 멤버가 볼 수 있습니다.
    • 이를 사용해 로비 멤버와만 데이터를 공유할 수 있습니다.
  • 비공개 로비 데이터는 호스트만 보고 설정할 수 있습니다.
    • 이는 다시 연결하는 데 사용될 수 있는 데이터 또는 호스트 마이그레이션이 있는 경우 차기 호스트에게 필요한 데이터를 설정하는 데 사용됩니다.
다음 코드 샘플은 로비 데이터를 업데이트하는 방법을 보여 줍니다. C#
try{ UpdateLobbyOptions options = new UpdateLobbyOptions(); options.Name = "testLobbyName"; options.MaxPlayers = 4; options.IsPrivate = false; //Ensure you sign-in before calling Authentication Instance //See IAuthenticationService interface options.HostId = AuthenticationService.Instance.PlayerId; options.Data = new Dictionary<string, DataObject>() { { "ExamplePrivateData", new DataObject( visibility: DataObject.VisibilityOptions.Private, value: "PrivateData") }, { "ExamplePublicData", new DataObject( visibility: DataObject.VisibilityOptions.Public, value: "PublicData", index: DataObject.IndexOptions.S1) }, }; var lobby = await LobbyService.Instance.UpdateLobbyAsync("lobbyId", options); //...}catch (LobbyServiceException e){ Debug.Log(e);}