using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System.IO;
public class Data : MonoBehaviour
{
private Dictionary<string, string> DateThing = new Dictionary<string, string>();
private string FilePath;
int i, j;
public Text text1;
public Text text2;
void Start()
{
//不同平台,不同路径存储文件
#if UNITY_ANDROID
FilePath = Application.persistentDataPath + "/PlayerInfo.txt";
#elif UNITY_IPHONE
FilePath = Application.persistentDataPath + "/PlayerInfo.txt";
#endif
#if UNITY_EDITOR
FilePath = Application.dataPath + "/PlayerInfo.txt";
#endif
JudgeFile();
text1.text = "i==" + i;
text2.text = "j==" + j;
}
void WriteInfoToFile()
{
FileInfo fileInfo = new FileInfo(FilePath);
StreamWriter strea
Unity移动端使用Text存储数据
最新推荐文章于 2024-06-18 14:59:19 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)