為了版本切換,想在手機加個文件做切換使用。使用Unity的Application提供的方法很不方便,位置被綁死。
還好 c#的 File在android上還有做用,要不然使用android裡的File還要經過一次 jar包,非常麻煩。
我們要做的是找到正確路徑即可。
if (File.Exists("/storage/sdcard/MD/1.txt"))
{
Debug.Log("have");
StreamReader file = new StreamReader("/storage/sdcard/MD/1.txt");
Debug.Log(file.ReadLine());
}
請先 登入 以發表留言。