public void OnButtonPostToLeaderboard() { Debug.Log("Posting score to leaderboard"); errorText.text = ""; //If there is no value in the score input field if (string.IsNullOrEmpty(scoreInputField.text)) { errorText.text = "Error: Could not post score to leaderboard. Please enter a value in the score input field."; return; } else { long scoreToPost; //Convert the value in the input field from string to long if (long.TryParse(scoreInputField.text, out scoreToPost)) { PlayGamesController.PostToLeaderboard(scoreToPost); } else { errorText.text = "Error: Could not post score to leaderboard. Please enter a valid score value."; } } }
public void PostToLeaderBoard() { ScoreToPost = GetComponent <Game>().Score; PlayGamesController.PostToLeaderboard(ScoreToPost); }