版本: 2022.3
语言英文
  • C#

Social.ReportScore

建议更改

成功!

感谢您帮助提高Unity文档质量。虽然我们无法接受所有提交,但我们确实阅读了每位用户提出的建议,在适用的情况下会进行更新。

关闭

提交失败

由于某些原因,您的建议无法提交。请 <a>几分钟后重试</a>。感谢您抽出时间帮助提高Unity文档质量。

关闭

取消

声明

public static void ReportScore(long score, string board, Action<bool> callback);

描述

向特定排行榜报告分数。

using UnityEngine;
using UnityEngine.SocialPlatforms;
using System.Collections;

public class ExampleClass : MonoBehaviour { void ReportScore(long score, string leaderboardID) { Debug.Log("Reporting score " + score + " on leaderboard " + leaderboardID); Social.ReportScore(score, leaderboardID, success => { Debug.Log(success ? "Reported score successfully" : "Failed to report score"); }); } }