首页 > 移动平台 > 详细

Application中的路径

时间:2015-11-21 15:57:01      阅读:370      评论:0      收藏:0      [点我收藏+]

前提

项目工程目录:E:/Work/cosmosbox/cb-client/

我电脑当前的用户名:qingqing

PersistentDataPath

Application.persistentDataPath 持久数据路径,APP更新时不会删除此数据 例:C:/Users/qingqing/AppData/LocalLow/Cosmosbox/

最后一位的目录名为PlayerSettings中设置的CompanyName

技术分享

在Windows平台可能因为用户名为非英文字条而出现其它麻烦,可以设置为 xxx/Library/UnityWinPersistentDataPath

public static string GetAppDataPath()
{
    // Windows 时使用特定的目录,避免中文User的存在
    if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsWebPlayer)
    {
        string dataPath = Application.dataPath + "/../Library/UnityWinPersistentDataPath";
        if (!Directory.Exists(dataPath))
            Directory.CreateDirectory(dataPath);
        return dataPath;
    }

    return Application.persistentDataPath;
}

详细:http://wiki.ceeger.com/script:unityengine:classes:application:application.persistentdatapath

 

dataPath

Application.dataPath 数据路径(Assets目录)  例:E:/Work/cosmosbox/cb-client/Assets

详细:http://wiki.ceeger.com/script:unityengine:classes:application:application.datapath?s[]=application

 

streamingAssetsPath

Application.streamingAssetsPath (Assets/StreamingAssets目录),AssetBundle一般存放在此目录下,可以通过www读取 例:E:/Work/cosmosbox/cb-client/Assets/StreamingAssets

Android:jar:file://+Application.dataPath+string.Format("!/assets/{0}/", ResourceDirName)

Unity Editor:file:///

详细:http://wiki.ceeger.com/script:unityengine:classes:application:application.streamingassetspath

 

temporaryCachePath

Application.temporaryCachePath 操作系统的临时缓存目录 ,例: Z:/TEMP/Cosmosbox/ [我的电脑把缓存文件设置在Z盘]

技术分享

详细:http://wiki.ceeger.com/script:unityengine:classes:application:application.temporarycachepath?s[]=application

Application中的路径

原文:http://www.cnblogs.com/zhaoqingqing/p/4983777.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!