플레이어 데이터 업데이트
Modify player-scoped custom data within a lobby to track individual player states and preferences.
읽는 시간 1분최근 업데이트: 한 달 전
플레이어는 로비에서 자신의 데이터를 업데이트할 수 있습니다. 로비 호스트와 다른 플레이어가 읽을 수 있는 데이터는 데이터 보기 옵션에 따라 다릅니다(로비 데이터 및 플레이어 데이터 참조). 다음 코드 샘플은 플레이어 데이터를 업데이트하는 방법을 보여 줍니다. C#
try{ UpdatePlayerOptions options = new UpdatePlayerOptions(); options.Data = new Dictionary<string, PlayerDataObject>() { { "existing data key", new PlayerDataObject( visibility: PlayerDataObject.VisibilityOptions.Private, value: "updated data value") }, { "new data key", new PlayerDataObject( visibility: PlayerDataObject.VisibilityOptions.Public, value: "new data value") } }; //Ensure you sign-in before calling Authentication Instance //See IAuthenticationService interface string playerId = AuthenticationService.Instance.PlayerId; var lobby = await LobbyService.Instance.UpdatePlayerAsync("lobbyId", playerId, options); //...}catch (LobbyServiceException e){ Debug.Log(e);}