在 Unity 中使用 Addressables 来遍历资源文件夹并将所有资源添加到 Addressable Asset System 中,可以按照以下步骤进行操作:

  1. 首先,确保你已经在 Unity 中安装了 Addressable Asset System,可以从 Unity Asset Store 中搜索并下载 Addressable Asset System 插件。

  2. 在 Unity 编辑器中,打开 Addressables 窗口。如果没有找到该窗口,可以通过'Window -> Asset Management -> Addressables'来打开它。

  3. 在 Addressables 窗口中,点击'Groups'选项卡,然后点击右上角的'+'按钮来创建一个新的 Group。将该 Group 命名为资源文件夹的名字。

  4. 在 Unity 的 Project 窗口中,找到你的资源文件夹,并将它拖放到 Addressables 窗口的 Groups 列表中的相应 Group 下。

  5. 打开资源文件夹,选中所有的资源文件,并将它们拖放到 Addressables 窗口的 Groups 列表中的相应 Group 下。

  6. 在 Addressables 窗口的 Groups 列表中,可以为每个 Group 设置加载方式、缓存方式等属性。根据你的需求进行相应的设置。

  7. 点击 Addressables 窗口的'Build'按钮,来构建 Addressable Asset System,将所有资源添加到 Addressable Asset System 中。

  8. 构建完成后,你可以在 Addressables 窗口的'Content'选项卡中查看所有的资源,并可以通过 Addressable 的方式来加载和管理它们。

通过以上步骤,你可以遍历资源文件夹,并将旗下所有资源所在的文件夹名作为 group 的名字,将所有资源添加到 Addressable Asset System 中。


原文地址: https://www.cveoy.top/t/topic/o2Qn 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录