Question by 
               morian35 · Jun 22, 2020 at 04:55 PM · 
                c#scripting problemplayerprefsgoogle playleaderboard  
              
 
              need help with code please
hi i make a 2d game and i want to submit the player highscore to googleplay leaderboard using cloudonce plugin so everything is good in the game i have highscore but the problem i have a script for highscore that get the bestscore from another script using playerpref and i make this playerprfe = currentscore but when i test the game in my phone it open googleplay but not sumbit anything in the leaderboard so can you please help me
this is my script
score script
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
 
 public class Score : MonoBehaviour
 {
     public AudioSource playerHit;
     private int score = 1;
     private GameplayManager gameplayManager;
 
 
     void Start()
     {
         playerHit = GetComponent<AudioSource>();   
     }
 
     private void Awake()
     {
         gameplayManager = GameObject.FindObjectOfType<GameplayManager>();
     }
 
 
 
      void OnTriggerEnter2D(Collider2D collision)
     {
         playerHit.Play();
         gameplayManager.UpdateScore(score);
         
 
     }
 }
GameplayManager script
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
 
 public class GameplayManager : MonoBehaviour
 {
 
     public Text scoreText;
     public Text highScore;
     private int currentScore;
 
     private void Start()
     {
         PlayerPrefs.SetInt("Points", 0);
         PlayerPrefs.GetInt("HighScore", 0);
     }
 
     public void UpdateScore(int score)
     {
         currentScore += score;
         scoreText.text = "" + currentScore.ToString();
         PlayerPrefs.SetInt("Points", currentScore);
 
         if(currentScore > PlayerPrefs.GetInt("HighScore", 0))
         {
             PlayerPrefs.SetInt("HighScore", currentScore);
         }
         
     }
 
 
     
 
 }
highscore script
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
 
 public class highscore : MonoBehaviour
 {
     private int currentScore;
     public Text bestScore;
     // Start is called before the first frame update
 
 
     void Awake()
     {
         currentScore = PlayerPrefs.GetInt("HighScore");
         bestScore.text = "" + currentScore.ToString();
 
         CloudOnceServices.instance.SubmitScoreToLeaderboard(currentScore);
 
     }
 }
 
CloudOnceServices script
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using CloudOnce;
 public class CloudOnceServices : MonoBehaviour
 {
     public static CloudOnceServices instance;
 
     private void Awake()
     {
         TestSingleton();
     }
 
     private void TestSingleton()
     {
         if (instance!= null) { Destroy(gameObject); return; }
         instance = this;
         DontDestroyOnLoad(gameObject);
        
     }
     
     public void SubmitScoreToLeaderboard(int currentScore)
     {
         Leaderboards.HighScore.SubmitScore(currentScore);
     }
 }
 
 
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
How to automatically generate a new int with a specific name? 1 Answer
I need help with my script please 1 Answer
can i get help please 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                