繁体   English   中英

Unity和Google Play服务中的语法问题

[英]Issues with Syntax in Unity and Google Play Services

我正在编写一个可与​​Google Play服务功能一起使用的脚本,只是导入了所有内容并准备就绪,但是由于某些原因,Unity不喜欢Google告诉我在功能末尾使用的语法}); 我没有运气试图找到解决方案,无奈之下我来到这里看看是否有人知道它。 任何答复都将不胜感激!

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

public class Destroy : MonoBehaviour {

    public GameObject Player;

    // Update is called once per frame
    void OnTriggerEnter2D(Collider2D other) {
        if(other.gameObject.tag == "Player") {
            DestroyObject(other.gameObject);
            Jumping.Dead = true;
            if (Points.BestScore >= PlayerPrefs.GetInt("BestScore")) {
                PlayerPrefs.SetInt("BestScore", Points.BestScore);
            }
            Application.LoadLevel(Application.loadedLevel);
        }
    }

    public void ReportToLeaderboard() {
        Social.ReportScore(PlayerPrefs.GetInt("BestScore")), "taken out for obvious reasons", (bool success) => {
                // Score Reported
        });
    }
}

这是我从以下位置获取源代码的地方: https : //github.com/playgameservices/play-games-plugin-for-unity

这是Unity错误:

Assets/Scripts/Destroy.cs(23,68): error CS1525: Unexpected symbol `,', expecting`;'

您,是因为你有额外的错误“ ) ”在Social.ReportScore(PlayerPrefs.GetInt("BestScore")**)**

这应该解决它

public void ReportToLeaderboard()
{
    Social.ReportScore(PlayerPrefs.GetInt("BestScore"), "taken out for obvious reasons", (bool success) =>
    {
        // Score Reported
    });
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM