2016-03-06 98 views
0

我正在編寫一個腳本來處理Google Play服務功能,並且我剛剛導入了所有內容並準備就緒,但由於某些原因,Unity不喜歡語法Google是告訴我在功能});的末尾使用。我試圖找出解決方案並沒有運氣,在絕望中我來到這裏,看看有沒有人知道它。任何反應都非常感謝!Unity和Google Play服務中的語法問題

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

,這裏是統一錯誤:

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

回答

1

你有錯誤,因爲你有額外的「)」在Social.ReportScore(PlayerPrefs.GetInt("BestScore")**)**

這應該修復它

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