유니티에 GPGS 플러그인을 이용해 Leaderboard 작업중 발생 하는 오류.
"Play 게임에 문제가 발생했습니다."
개인적인 경험으로 테스트를 안드로이드 emulator 또는 Nox와 같은 앱플레이어에서 할 경우 잘 발생 했다.
이런 오류는 앱 설치 후 리더보드를 보는 기능까지는 문제가 없지만 LeaderBoard에 점수를 입력하는 경우, 위와 같은 에러와 함께 이후 LeaderBoard와 관련된 어떤 작업도 할 수 없게 된다.
이럴 경우 다음과 같이 해결 했다.
1. Google Console에 다음 버전의 APK 를 업로드 하여 출시
2. 기기에 기존 버전의 앱 삭제
2. Google Play에서 앱을 다운 받아서 재 설치 후 테스트
2019년 6월 25일 화요일
Unity GPGS LeaderBoard 정보 획득 및 가공
유니티에서 구글 리더보드에 등록되어 있는 내 점수를 획득 하는 방법
그리고 리더보드의 정보를 획득해 다음과 같이 가공할 수 있다.
출처 : https://stackoverflow.com/questions/55234701/google-play-games-leaderboard-custom
using UnityEngine;
using GooglePlayGames;
using UnityEngine.SocialPlatforms;
public class GPGSIntegration : MonoBehaviour
{
long bestScore;
void GetLeaderBoardScore()
{
ILeaderboard lb = PlayGamesPlatform.Instance.CreateLeaderboard();
// GPGS에서 생성한 GPGSIds 클래스 리더보드 변수명
lb.id = GPGSIds.leaderboard_bestscore;
lb.LoadScores(scores =>
{
bestScore = lb.localUserScore.value;
});
}
}
그리고 리더보드의 정보를 획득해 다음과 같이 가공할 수 있다.
using UnityEngine;
using GooglePlayGames;
using UnityEngine.SocialPlatforms;
public class GPGSIntegration : MonoBehaviour
{
long bestScore;
void ShowLeaderBoardMyInfo()
{
ILeaderboard lb = PlayGamesPlatform.Instance.CreateLeaderboard();
// GPGS에서 생성한 GPGSIds 클래스 리더보드 변수명
lb.id = GPGSIds.leaderboard_bestscore;
lb.userScope = UserScope.Global;
lb.range = new Range(1,10);
lb.timeScope = TimeScope.AllTime;
lb.LoadScores(scores =>
{
uint all_player = lb.maxRange;
int my_rank = lb.localUserScore.rank;
decimal percent = (decimal)my_rank / (decimal)all_player;
text.text = scores.ToString() + "\nAllPlayer: " + all_player + "\nMyRank: " + my_rank + "\nMyScore: " +lb.localUserScore.value.ToString() + "\nPercent: " + percent + "%";
});
}
}
출력 정보출처 : https://stackoverflow.com/questions/55234701/google-play-games-leaderboard-custom
피드 구독하기:
글 (Atom)
Unity - Firebase 연동 (Analytics, AdMob)
버전 : firebase_unity_sdk_6.5.0.zip 게임에서 통계 측정 및 광고 추적을 위해 Firebase 을 연동한다. 앞서 [Unity - GPGS 와 Admob 연동 및 배포 준비 작업] 연동 이후에 작업을 진행 한다. 유니...