Unity-Application之相关目录长什么样子

Unity-Application之相关目录长什么样子

#Windows_x64_Unity_Editor:

// Unity_project_folder:你的U3D项目目录,如:C:/TestingU3DProject
// your account name:你PC登录帐号,如:Administrator
Application.dataPath:[Unity_project_folder]/Assets
Application.persistentDataPath:C:/Users/[your account name]/AppData/LocalLow/ThisIsMyCompanyName/ThisIsMyAppName
Application.streamingAssetsPath:[Unity_project_folder]/Assets/StreamingAssets
Application.temporaryCachePath:C:/Users/[your account name~1]/AppData/Local/Temp/ThisIsMyCompanyName/ThisIsMyAppName

#Windows_x64_PC_Build:
和Windows_x64_Unity_Editor区别很小

// ProgramFiles_folder:你的build_name应用程序的运行目录
// build_name:build时你输入的.exe名称
// your account name:你PC登录帐号,如:Administrator
Application.dataPath:[ProgramFiles_folder]/[build_name]_Data
Application.persistentDataPath:C:/Users/[your account name]/AppData/LocalLow/ThisIsMyCompanyName/ThisIsMyAppName
Application.streamingAssetsPath:[ProgramFiles_folder]/[build_name]_Data/StreamingAssets
Application.temporaryCachePath:C:/Users/[your account name~1]/AppData/Local/Temp/ThisIsMyCompanyName/ThisIsMyAppName

#Android-Mumu-Emulator:

Application.dataPath:/data/app/com.ThisIsMyCompanyName.ThisIsMyAppName-1.apk
Application.persistentDataPath:/storage/emulated/0/Android/data/com.ThisIsMyCompanyName.ThisIsMyAppName/files
Application.streamingAssetsPath:jar:file:///data/app/com.ThisIsMyCompanyName.ThisIsMyAppName-1.apk!/assets
Application.temporaryCachePath:/storage/emulated/0/Android/data/com.ThisIsMyCompanyName.ThisIsMyAppName/cache

#Android:
?(没机器,后面那同事的来测试)

#iOS:
?(有机器没越狱,没开发者帐号,后面在测试)


References


streamingAssets - 流媒体资源

Unity 在构建项目时将大多数资源整合到项目中。但是,将文件放入目标计算机上的普通文件系统以使其可通过路径名访问有时会很有用。这方面的一个例子是在 iOS 设备上部署电影文件;原始电影文件必须位于文件系统中的某个位置以便由 PlayMovie 函数进行播放。

Unity 会将放置在 Unity 项目中名为 StreamingAssets__(区分大小写)的文件夹中的所有文件逐字复制到目标计算机上的特定文件夹。要获取此文件夹,请使用 Application.streamingAssetsPath 属性。在任何情况下,最好使用 Application.streamingAssetsPath 来获取 StreamingAssets__ 文件夹的位置,因为它总是指向运行应用程序的平台上的正确位置。

Application.streamingAssetsPath 返回的位置因平台而异:

大多数平台(Unity Editor、Windows、Linux 播放器、PS4、Xbox One、Switch)使用 Application.dataPath + “/StreamingAssets”。
macOS 播放器使用 Application.dataPath + “/Resources/Data/StreamingAssets”。
iOS 使用 Application.dataPath + “/Raw”。
Android 使用经过压缩的 APK/JAR 文件中的文件:“jar:file://” + Application.dataPath + “!/assets”。
要在无法直接访问流媒体资源文件的平台(如 Android 和 WebGL)上读取流媒体资源,请使用 UnityWebRequest。有关示例,请参阅 Application.streamingAssetsPath。

在许多平台上,流媒体资源文件夹位置是只读的;您不能在运行时在这些位置修改或写入新文件。请使用 Application.persistentDataPath 来获取可写的文件夹位置。

注意:位于 StreamingAssets 文件夹中的 .dll 和脚本文件不参与脚本编译。

也可以通过资源包 (Asset Bundle) 或可寻址资源 (Addressable) 来访问不属于常规游戏构建数据的内容,在许多情况下,这些访问方式优于流媒体资源 (Streaming Assets) 文件夹。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值