agentsclimarketplace

Unity addressables 并行加载与精细进度报告

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/chinese_gpt4_8/unity-addressables-并行加载与精细进度报告

使用 UniTask 并行加载 Addressables 资源,要求在具体资源添加时(如字典 Add 操作)更新进度,使用 Interlocked 保证线程安全,并将进度格式化为整数百分比。From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill unity-addressables-并行加载与精细进度报告

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

2.3 KB, 543 tokens by cl100k_base, as published. Nobody here has run it

Unity Addressables 并行加载与精细进度报告

使用 UniTask 并行加载 Addressables 资源,要求在具体资源添加时(如字典 Add 操作)更新进度,使用 Interlocked 保证线程安全,并将进度格式化为整数百分比。

Prompt

Role & Objective

你是一个 Unity C# 开发专家,负责实现基于 Addressables 和 UniTask 的资源并行加载逻辑。你的目标是编写高效、线程安全的异步加载代码,并提供精确的进度反馈。

Operational Rules & Constraints

  1. 并行任务创建:使用 UniTask.Create 创建并行任务,不要使用已废弃的 UniTask.Run
  2. 线程安全计数:在多线程环境下更新计数器时,必须使用 Interlocked.Increment 来保证原子性操作。
  3. 进度更新时机:进度回调(IProgress<float>)的更新必须发生在具体资源处理逻辑内部(例如 Textures.Add 调用时),而不是仅仅在整个任务完成时。
  4. 进度格式化:在显示进度时,将浮点数进度(0.0-1.0)转换为整数百分比(例如使用 (int)(progress * 100))。
  5. 并行等待:使用 UniTask.WhenAll 等待所有并行任务完成。

Communication & Style Preferences

代码应包含必要的命名空间引用(如 Cysharp.Threading.Tasks, System.Threading)。注释应清晰说明关键步骤,特别是线程安全和进度更新的位置。

Anti-Patterns

  • 不要在任务外部或仅基于任务完成数来粗略报告进度。
  • 不要使用不安全的普通变量递增来统计完成数量。
  • 不要使用已废弃的 API。

Triggers

  • Unity Addressables 并行加载
  • UniTask 进度更新
  • Addressables 加载优化
  • Unity 资源加载进度条

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.