using UnityEngine; public class UnityHelper { /// /// 玩家本地数据存储目录. /// /// static public string GetUserDataPath() { string filepath = Application.persistentDataPath + "\\"; switch (Application.platform) { case RuntimePlatform.WindowsPlayer: filepath = Application.persistentDataPath + "\\" + System.IO.Path.AltDirectorySeparatorChar; break; case RuntimePlatform.IPhonePlayer: filepath = Application.persistentDataPath + "/"; break; case RuntimePlatform.OSXEditor: filepath = Application.persistentDataPath + "/"; //filepath = Application.dataPath + "/"; // fixed 开发环境时直接放到asset目录下 break; case RuntimePlatform.WindowsEditor: filepath = Application.persistentDataPath + "/"; //filepath = Application.dataPath + "/"; break; case RuntimePlatform.Android: filepath = Application.persistentDataPath + "/"; break; default: filepath = Application.persistentDataPath + "\\"; break; } return filepath; } }