이 질문을 입력하기 전에이 문제에 2 주간 붙어서 많이 검색했습니다. '() 에 설명 된대로Unity Android 게임 Google Play 게임 플러그인을 사용하여 로그인 할 수 있지만 리더 보드에서 점수를로드 할 수 없음
1 통합 구글 플레이 게임 플러그인 :. 내 유니티 프로젝트에서 구글 리더 기능이 나는 다음과 같은 단계를 따라 https://github.com/playgameservices/play-games-plugin-for-unity
- 만든 내 구글 플레이 개발자 콘솔에서 구글 플레이 서비스 게임 항목 및 오픈 아이디의 com.o6systems.zray 패키지 아이디와 함께 (같은 콘솔에있는) 내 애플리케이션에 연결하십시오. pha 테스트.
- 크레딧을 생성하고 키 스토어/키 쌍의 SHA1을 Google API 콘솔에 삽입했습니다.
- 나는 도전 과제, 1 개 점수 판을 만들어 내 자원은 창/GooglePlayGames/설정/안드로이드 설정
내가 사용하는 키 스토어는 SHA1 코드를 생성하는 동일에 입력하세요. 플레이어 설정과 암호에 입력했습니다.
내 패키지 이름은 내가 콘솔에서 테스트 사용자에게 내 테스트 사용자를 입력
(구글 사방 연합, Play 개발자 콘솔 구글 API를 콘솔에서) 모든 플랫폼에서 일치한다.
void Start() {
#if UNITY_ANDROID
ConfigureGooglePlay();
SignIn();
#endif
}
void ConfigureGooglePlay(){
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
.Build();
PlayGamesPlatform.InitializeInstance(config);
PlayGamesPlatform.DebugLogEnabled = true;
PlayGamesPlatform.Activate();
}
void SignIn() {
Social.localUser.Authenticate (success => {
if (success) {
Debug.Log ("Authentication successful");
string userInfo = "Username: " + Social.localUser.userName +
"\nUser ID: " + Social.localUser.id +
"\nIsUnderage: " + Social.localUser.underage;
Debug.Log (userInfo);
// DisplayGPScore();
} else
Debug.Log ("Authentication failed");
});
}
3- 게임 장면에서, 게임에 내가 리더에 사용자의 높은 점수를 게시 이상 : 스크립트 내되는 SplashScreen 현장에서 작업의
2
나는 하나의 인증을 위해 다음과 같은 코드를 입력 ReportScore 기능private void OnGameOver(){
...
PostScore(_gm.highScore);
..
DisplayGPScore();
}
internal void LoadUsersAndDisplay(ILeaderboard lb)
{
// get the user ids
List<string> userIds = new List<string>();
foreach(IScore score in lb.scores) {
userIds.Add(score.userID);
}
// load the profiles and display (or in this case, log)
Social.LoadUsers(userIds.ToArray(), (users) =>
{
string status = "Leaderboard loading: " + lb.title + " count = " +
lb.scores.Length;
foreach(IScore score in lb.scores) {
Debug.Log("" + score.rank + ":" + score.userID);
}
Debug.Log(status);
});
}
public void DisplayGPScore(){
ILeaderboard lb = PlayGamesPlatform.Instance.CreateLeaderboard();
lb.id = ZRayGameManager.WORLD_LEADERBOARD_ID;
lb.LoadScores(ok =>
{
if (ok) {
LoadUsersAndDisplay(lb);
}
else {
Debug.Log("Error retrieving leaderboardi");
}
});
}
public void PostScore(int score){
PlayGamesPlatform.Instance.ReportScore(score, ZRayGameManager.WORLD_LEADERBOARD_ID, (bool success) => {
if(success){
Debug.Log("High score " + score + " posted");
}else{
Debug.Log("High score " + score + " could not be posted");
}
});
}
를 사용하여 I는 코드 (제외 관계없는 부분) I는 다음과 같은 결과를 얻을
단순화 012,351
6,I/Unity (15970):
I/Unity (15970): Authentication successful
I/Unity (15970):
I/Unity (15970): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
bugBindings.gen.cpp Line: 37)
I/Unity (15970):
I/Unity (15970): Username: RighthandedTuba240
I/Unity (15970): User ID: g02637898988054749692
I/Unity (15970): IsUnderage: True
I/Unity (15970):
I/Unity (15970): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
bugBindings.gen.cpp Line: 37)
I/Unity (15970):
I/Unity (15970): [Play Games Plugin DLL] 07/17/16 18:46:52 +03:00 DEBUG: Repo
rtScore: score=100, board=CgkIppHPm-wIEAIQCQ
I/Unity (15970):
I/Unity (15970): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
bugBindings.gen.cpp Line: 37)
I/Unity (15970):
I/Unity (15970): [Play Games Plugin DLL] 07/17/16 18:46:52 +03:00 DEBUG: Nati
ve Submitting score: 100 for lb CgkIppHPm-wIEAIQCQ with metadata:
I/Unity (15970):
I/Unity (15970): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
bugBindings.gen.cpp Line: 37)
I/Unity (15970):
I/Unity (15970): User is authenticated
I/Unity (15970):
I/Unity (15970): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
bugBindings.gen.cpp Line: 37)
I/Unity (15970):
I/Unity (15970): [Play Games Plugin DLL] 07/17/16 18:46:52 +03:00 DEBUG: Load
Scores, board=GooglePlayGames.PlayGamesLeaderboard callback is System.Action`1[S
ystem.Boolean]
I/Unity (15970):
I/Unity (15970): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
bugBindings.gen.cpp Line: 37)
I/Unity (15970):
I/Unity (15970): [Play Games Plugin DLL] 07/17/16 18:46:52 +03:00 DEBUG: Invo
king user callback on game thread
I/Unity (15970):
I/Unity (15970): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
bugBindings.gen.cpp Line: 37)
I/Unity (15970):
I/Unity (15970): High score 100 posted
I/Unity (15970):
I/Unity (15970): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
bugBindings.gen.cpp Line: 37)
I/Unity (15970):
I/Unity (15970): [Play Games Plugin DLL] 07/17/16 18:46:55 +03:00 DEBUG: Ente
ring internal callback for LeaderboardManager#InternalFetchCallback
I/Unity (15970):
I/Unity (15970): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
bugBindings.gen.cpp Line: 37)
I/Unity (15970):
I/Unity (15970): [Play Games Plugin DLL] 07/17/16 18:47:10 +03:00 DEBUG: Star
ting Auth Transition. Op: SIGN_OUT status: ERROR_NOT_AUTHORIZED
I/Unity (15970):
I/Unity (15970): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
bugBindings.gen.cpp Line: 37)
I/Unity (15970):
I/Unity (15970): [Play Games Plugin DLL] 07/17/16 18:47:10 +03:00 DEBUG: Ente
ring internal callback for LeaderboardManager#InternalFetchSummaryCallback
I/Unity (15970):
I/Unity (15970): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
bugBindings.gen.cpp Line: 37)
I/Unity (15970):
W/Unity (15970): !!! [Play Games Plugin DLL] 07/17/16 18:47:10 +03:00 WARNING:
Error returned from fetchScoreSummary: GooglePlayGames.Native.PInvoke.FetchScor
eSummaryResponse
W/Unity (15970):
W/Unity (15970): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
bugBindings.gen.cpp Line: 37)
W/Unity (15970):
I/Unity (15970): [Play Games Plugin DLL] 07/17/16 18:47:10 +03:00 DEBUG: Invo
king user callback on game thread
I/Unity (15970):
I/Unity (15970): (Filename: ./artifacts/generated/common/runtime/UnityEngineDe
bugBindings.gen.cpp Line: 37)
I/Unity (15970):
I/Unity (15970): Error retrieving leaderboardi
결론 :
에서 메소드 로그인()가 성공적으로 인증을 알려주고 사용자 정보를 출력하기 때문에 사용자가 인증 할 수 있습니다.
사용자는 점수 판에 그/그녀의 점수를 게시 할 수 있으며, PostScore 방법을 알려주기 때문에
이 사용자는 점수 판 점수를 표시 할 수 없습니다 "높은 점수 (100)는 게시"
승/유니티 (15970) : !!! 00 경고 : 오류 fetchScoreSummary에서 반환 : 07/17/16 18시 47분 10초 03는 [게임 플러그인 DLL을 재생] GooglePlayGames.Native.PInvoke.FetchScor eSummaryResponse
내가 점수 판의 설정을 찾을 수 없습니다콘솔에서 사용자가이 스코어 보드에 액세스 할 수있게하십시오.
도와주세요!여기에 2 주간 붙어 있습니다 (하지만 개선이 있었지만 3 일 전에 로그인 할 수 없었습니다)
안녕하십니까? 아직이 문제가 발생합니까? –