為了版本切換,想在手機加個文件做切換使用。使用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());
    }
創作者介紹
創作者 初學者日記 的頭像
初學者日記

初學者日記

初學者日記 發表在 痞客邦 留言(0) 人氣( 596 )