我設置紋理2是在這樣的PlayerPrefs新的「紋理」:如何用字符串引用紋理?
PlayerPrefs.SetString("texture","texture2")
但我怎麼可以把下面的腳本的字符串:
PlayerPrefs.GetString("texture")
到:
mainTexture = PlayerPrefs.GetString("texture")
所以它會將「紋理2」變成紋理:
mainTexture = texture2
我沒有使用變量,因爲我想要選擇的紋理被保存(並加載)。提前致謝!任何幫助表示讚賞! :)
使用PlayerPrefs.Save()如果你正在爲android做數據保存,如果它是PC沒有需要 – 2014-09-26 08:07:51
因此,而不是PlayerPrefs.SetString,我應該做PlayerPrefs.Save?或者只留下字符串並在其下面添加'PlayerPrefs.Save'? – Bartvb98 2014-09-26 08:18:15
不,在改變場景之前使用PlayerPrefs.Save()不要改變任何東西 – 2014-09-26 08:20:01