IEnumerator SaveText() の代わりに
-----------------
void WriteFile(string txt)
{
string path = "";
//guitxt = "書き込み\n";
if (Application.platform == RuntimePlatform.Android)
{
// Android
path = Application.persistentDataPath + "/" + outputTextData;
FileInfo fi = new FileInfo(path);
guitxt += " - and\n";
using (StreamWriter sw = fi.CreateText())
{
sw.WriteLine(guitxt);
}
}
else if (Application.platform == RuntimePlatform.WindowsEditor)
{
//Unity
path = Application.dataPath + "/" + outputTextData;
FileInfo fi = new FileInfo(path);
guitxt += " - uni\n";
using (StreamWriter sw = fi.CreateText())
{
sw.WriteLine(guitxt);
}
}
else if (Application.platform == RuntimePlatform.WindowsPlayer)
{
// Windows
path = Application.dataPath + "/" + outputTextData;
FileInfo fi = new FileInfo(path);
guitxt += " - win\n";
using (StreamWriter sw = fi.CreateText())
{
sw.WriteLine(guitxt);
}
}
else
{
//other
path = Application.dataPath + "/" + outputTextData;
FileInfo fi = new FileInfo(path);
guitxt += " - oth\n";
using (StreamWriter sw = fi.CreateText())
{
sw.WriteLine(guitxt);
}
}
}
-----------------
とか
-----------------
void WriteFile2(string txt)
{
string path = "";
//guitxt = "書き込み\n";
#if UNITY_EDITOR
path = Application.dataPath + "/" + outputTextData;
FileInfo fi = new FileInfo(path);
using (StreamWriter sw = fi.CreateText())
{
sw.WriteLine(guitxt);
}
#elif UNITY_ANDROID
path = Application.persistentDataPath + "/" + outputTextData;
FileInfo fi = new FileInfo(path);
using (StreamWriter sw = fi.CreateText())
{
sw.WriteLine(guitxt);
}
#endif
}
-----------------
なんかを使っても、同じになる
- 関連記事
-
YouTubeで動画を定期的に出しています。ご視聴いただけると嬉しいです。
Reon Labo
- 2017/03/15(水) 22:18:13|
- Unity
-
| トラックバック:0
-
| コメント:0