In this picture,日誌打印漂亮! 但統一輸出是錯誤的。 我該如何解決它?Unity + php +數據庫數據輸出問題
這是我的源:
private void Awake()
{
info = new Dictionary<string, string>();
}
private IEnumerator Start()
{
WWW dash = new WWW("http://localhost/test.php");
yield return dash;
string[] Separators = new string[] { "\n" };
string[] lines = dash.text.Split(Separators, System.StringSplitOptions.RemoveEmptyEntries);
info.Clear();
for(int i=0; i<lines.Length; i++)
{
GameObject tmp = Instantiate(scorepre);
string[] parts = lines[i].Split(',');
string Name = parts[1];
string Detail = parts[2];
info.Add(Name, Detail);
Debug.Log(Name + " - " + Detail);
named.GetComponent<Text>().text = Name;
detailed.GetComponent<Text>().text = Detail;
tmp.transform.SetParent(infoParent);
}
are are named and detailed game objects defined? – ColmanJ
是的,我定義了。 –
private Dictionary info; public Transform infoParent; public GameObject scorepre; public GameObject named; public GameObject詳細說明; 這些都是我的定義。 –