美文网首页
Unity 平台路径地址

Unity 平台路径地址

作者: SilenceTT | 来源:发表于2022-06-15 10:20 被阅读0次

    一) android 平台中的资源路径

    Application.dataPath                /data/app/xxx.xxx.xxx.apk
    
    Application.streamingAssetsPath     jar:file:///data/app/xxx.xxx.xxx.apk/!/assets
    
    Application.persistentDataPath      /data/data/xxx.xxx.xxx/files
    
    Application.temporaryCachePath      /data/data/xxx.xxx.xxx/cache
    

    二) ios 平台中的资源路径

    Application.dataPath                Application/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/xxx.app/Data
    
    Application.streamingAssetsPath     Application/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/xxx.app/Data/Raw
    
    Application.persistentDataPath      Application/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/Documents
    
    Application.temporaryCachePath      Application/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/Library/Caches
    

    StreamingAssets文件夹下的只读不可写路径:

    以Application.streamingAssetsPath为基准 :  jar:file:///data/app/xxx.xxx.xxx.apk/!/assets
    
    安卓读:filePath = Application.streamingAssetsPath + "/文件名.格式名";
    
        filePath = "jar:file://" + Application.dataPath + "/!/assets" + "/文件名.格式名";
    
        IOS读: filePath = "file://" +  Application.streamingAssetsPath + "/文件名.格式名";
    
                  filePath = "file://" +  Application.dataPath + "/Raw" + "/文件名.格式名";
    
        PC读:filePath = "file://" + Application.streamingAssetsPath + "/文件名.格式名";/
    
    Unity内部的可读可写路径:
    
        安卓: path = Application.persistentDataPath + "/文件名.格式名";
    
        IOS: path =  Application.persistentDataPath + "/文件名.格式名"; //未验证
    
        PC: path = "file://" + Application.persistentDataPath + "/文件名.格式名";//
    

    相关文章

      网友评论

          本文标题:Unity 平台路径地址

          本文链接:https://www.haomeiwen.com/subject/mhfxvrtx.html