我有这个单例在我的画布中在多个场景之间写入玩家名称和他的团队名称,但控制台显示此错误:" Assets / Scripts / GlobalControl.cs(1,19):错误CS8025:解析错误&#34 ;.有人可以帮我解决吗?
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class GlobalControl : MonoBehaviour
{
private static GlobalControl instance = null;
private Text displayPlayer;
private Text displayTeam;
void Awake ()
{
if (instance == null)
{
DontDestroyOnLoad(gameObject);
instance = this;
}
else if (instance != this)
{
Destroy (gameObject);
}
}
void Start()
{
displayPlayer = GameObject.Find ("displayPlayer").GetComponent<Text> ();
displayTeam = GameObject.Find ("displayTeam").GetComponent<Text> ();
new GameSparks.Api.Requests.AccountDetailsRequest ()
.SetDurable(true)
.Send ((response) => {
displayPlayer.text = response.DisplayName;
} );
new GameSparks.Api.Requests.GetMyTeamsRequest()
.SetDurable(true)
.Send(teamResp => {
if(!teamResp.HasErrors)
{
foreach(var teams in teamResp.Teams)
{
Debug.Log("Equipo: " + teams.TeamId);
displayTeam.text = teams.TeamId;
}
}
} );
}
}