using System.Collections; using System.Collections.Generic; using UnityEngine; public class PathHelper{ // 用于bundle读取的streaming路径 // 不需要加file://协议 public static string GetStreamingFullFilePath(string filePath) { #if UNITY_ANDROID return Application.dataPath + "!assets/" + filePath; #else return Application.streamingAssetsPath + "/" + filePath; #endif } // 用于www读取的streaming路径 // 需要加file协议 public static string GetStreamingWWWFullFilePath(string filePath) { #if UNITY_ANDROID return Application.streamingAssetsPath + "/" + filePath; #else return "file://" + Application.streamingAssetsPath + "/" + filePath; #endif } public static string GetPersistentFullFilePath(string filePath) { return Application.persistentDataPath + "/" + filePath; } #if UNITY_IOS // 将文件从自动上传iCloud中排除 public static void ExcludeFileFromiCloud(string filePath) { string full = GetPersistentFullFilePath(filePath); UnityEngine.iOS.Device.SetNoBackupFlag(full); } #endif }