게임개발/개발테스트
유니티 구글 플레이 게임즈 연동 v11.01(로그인)
연습생_동동
2022. 9. 20. 15:10
모바일 게임 포트폴리오를 만들기 위해 구글 플레이 게임즈 연동을 하려는데 최신 버전이 이전 버전들과 많이 달라 자료가 없어 몇가지 알게 된 것들을 기록해 놓으려 한다.
기존의 방식으로 로그인 버튼을 만들려 하면 PlayGamesClientConfiguration가 없다고 나온다.
그 이유는 여기서 찾을 수 있다.
https://developer.android.com/games/preview/multiplatform/pgs-unity-integration-guide?hl=ko
Play 게임즈 서비스 통합 가이드(Unity) | Android 개발자 | Android Developers
Play 게임즈 서비스 통합 가이드(Unity) 컬렉션을 사용해 정리하기 내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요. 참고: 네이티브 (C) 버전의 SDK도 EAP에서 사용할 수 있습니다. 액세스 방
developer.android.com
로그인 자체를 GPGS에서 관리하고 개발자는 그 결과를 받아 사용하도록 바뀌었다.
결과를 받아오는 코드는 다음과 같다.
using GooglePlayGames;
public void Start() {
PlayGamesPlatform.Instance.Authenticate(ProcessAuthentication);
}
internal void ProcessAuthentication(SignInStatus status) {
if (status == SignInStatus.Success) {
// Continue with Play Games Services
} else {
// Disable your integration with Play Games Services or show a login button
// to ask users to sign-in. Clicking it should call
// PlayGamesPlatform.Instance.ManuallyAuthenticate().
}
}
만약 자동 로그인이 실패했을 경우를 대비해, 수동 로그인을 하는 코드 또한 제공하고 있다.
PlayGamesPlatform.Instance.ManuallyAuthenticate(ProcessAuthentication);