M
M
MarioKrut2020-06-10 10:33:44
Unity
MarioKrut, 2020-06-10 10:33:44

Top rating in unity, script not working?

There is a script

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GooglePlayGames;
using GooglePlayGames.BasicApi;
using UnityEngine.SocialPlatforms;

public class TOP : MonoBehaviour
{
    private const string leaderboard = "CgkI2pnKuuEF-----";
    private int score;

    void Start(){
    	PlayGamesPlatform.Activate();
    }

    void OnMouseDown (){
    	transform.localScale = new Vector3 (transform.localScale.x / 1.2f, transform.localScale.y / 1.2f, transform.localScale.z / 1.2f);
    }
    void OnMouseUp (){
    	transform.localScale = new Vector3 (transform.localScale.x * 1.2f, transform.localScale.y * 1.2f, transform.localScale.z * 1.2f);
    }

    void OnMouseUpAsButton()
    {
    score = PlayerPrefs.GetInt("balance");
    // Активировать Google Play Games Platform   
    Social.localUser.Authenticate((bool success) => {
        if (success) print("Удачно");
        else print("Неудачно");
    });    

    Social.ReportScore(score, leaderboard, (bool success) => {
        if (success) print("Удачно2");
        else print("Неудачно2");
    });

    Social.ShowLeaderboardUI();

    }

    void OnApplicationQuit(){
    	PlayGamesPlatform.Instance.SignOut();
    }
}

I make a Build apk file and upload it to my phone!
When you click on the button, the leaderboard does not open!
Can you tell me what is the error in the code?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2020-06-10
@freeExec

Put in Package Manager Android Logcatand see the application logs. There must be some mistake there. Or cover your code with logs to see where it was executed, and where it didn’t even reach. Well, the surest case is to build a build that can be debugged directly on the device.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question