game-assets-memory

game-assets-memory is a skill for Claude Code, Codex from Wade-DevCode/awesome-coding-skills-cn. It costs 29 tokens per session (2,723 once invoked), scanned A, original, MIT.

Guidance for loading, unloading, packaging, and tracking memory used by game assets such as textures, sounds, scenes, models, and configuration data. It applies to systems such as Addressables or AssetBundles, which manage downloadable or grouped game resources.

In plain words
What is it for?
Use it when adding resource loading, investigating memory growth, choosing an asset-management system, or debugging crashes, oversized builds, and resources that do not unload.
Why use it?
It helps avoid freezes caused by loading large resources on the main game thread, using assets before they are ready, and memory leaks after changing scenes.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/wade-devcode/awesome-coding-skills-cn/game-assets-memory
Any agent
npx skills add Wade-DevCode/awesome-coding-skills-cn --skill game-assets-memory
Clone the repo
git clone --depth 1 https://github.com/Wade-DevCode/awesome-coding-skills-cn

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for game-assets-memory

README.md
[![agentmods](https://agentmods.dev/badge/skills/wade-devcode/awesome-coding-skills-cn/game-assets-memory.svg)](https://agentmods.dev/skills/wade-devcode/awesome-coding-skills-cn/game-assets-memory)
Your own site
<a href="https://agentmods.dev/skills/wade-devcode/awesome-coding-skills-cn/game-assets-memory"><img src="https://agentmods.dev/badge/skills/wade-devcode/awesome-coding-skills-cn/game-assets-memory.svg" alt="Measured on agentmods" height="20"></a>
Per session 29 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,723 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00029 $0.02723
Opus 5 $0.00015 $0.01362
Sonnet 5 $0.00006 $0.00545
Haiku 4.5 $0.00003 $0.00272

Measured 4d ago against content hash ef98d0aa3b3f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

game-assets-memory scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/game-assets-memory/SKILL.md · 183 lines

How it starts

The opening of the file, as written. The whole thing — 183 lines — stays where its author put it; the contents beside it link to each section on GitHub.

资源与内存

何时用

  • 新增资源加载逻辑(模型、纹理、音效、配置表)之前。
  • 发现内存持续增长、场景切换后内存不降、或 Profiler 显示某类资源异常堆积时。
  • 接入新的资源管理系统(Addressables、AssetBundle、自研热更)前做方案评审时。
  • 出现「卸载了但内存没降」「切场景崩溃」「包体超预算」等问题排查时。

核心规则

1. 大资源必须异步加载

规则: 纹理、音频、场景、模型等大资源一律走异步接口加载,绝不在主线程同步读取;加载期间必须有合适的 loading 表现,加载完成回调后再使用资源。

为什么: 最常犯的错是原型阶段用同步加载图方便,上线前"有时间再改"——结果积累了几十处同步加载,进游戏时主线程卡顿 2 秒,ANR 投诉爆仓。另一个坑:异步加载发起后立刻用资源(还没加载完),导致空引用崩溃或用到上一次缓存的错误资源。

怎么做:

// Unity 示例
// 反例 — 同步加载阻塞主线程
var tex = Resources.Load<Texture2D>("hero/sword");   // ❌ 主线程阻塞

// 正例 — 异步加载,回调中使用
IEnumerator LoadHeroAsync(string key, Action<GameObject> onLoaded) {
    var handle = Addressables.LoadAssetAsync<GameObject>(key);
    yield return handle;                          // ✅ 异步等待
    if (handle.Status == AsyncOperationStatus.Succeeded) {
        onLoaded(handle.Result);                  // ✅ 加载完再用
    } else {
        Debug.LogError($"加载失败: {key}");
    }
}
  • 加载过程中显示 loading 进度条或骨骼屏;加载超时(如 10 秒)要有降级或报错逻辑,不能死等。
  • 预加载(Preload)在合适时机(进房间动画期间)提前触发,不要等玩家操作时才开始加载。

2. 引用计数与卸载时机必须明确

规则: 每个资源的生命周期(谁持有、何时释放)必须在接入时明确设计;场景切换时主动释放当前场景独占的资源,不依赖 GC 或引擎的"自动"回收。

为什么: 最典型的泄漏路径:战斗场景加载了 50 个怪物预制体的纹理,战斗结束切回大厅,没有主动 Release,Addressables 的引用计数没归零,纹理全留在内存里。打完十场战斗内存涨到崩溃。反向问题也有:卸载太激进,在某个地方还持有引用时就强制卸载,运行时出现粉色/错误材质。

怎么做:

  • 使用 Addressables/AssetBundle 时,每次 LoadAssetAsync 对应一次 Release,用 RAII 或引用计数封装保证配对。
  • 场景切换时有明确的「场景资源卸载」阶段:先通知所有系统释放本场景资源引用,再触发 UnloadUnusedAssets
  • 共享资源(公共 UI 图集、常驻音效)单独管理,不随场景卸载;战斗专属资源随战斗结束卸载。
  • 建立资源持有关系图(哪个系统持有哪些资源),在代码注释或文档中维护,避免「不知道谁在引用」的黑盒状态。

3. 图集与压缩格式要选对

规则: UI 精灵和 2D 素材必须打图集减少 Draw Call;纹理压缩格式按平台和内容类型选择(Android 用 ETC2/ASTC,iOS 用 ASTC,PC 用 BC7/DXT5),不能全部用未压缩 RGBA32。

为什么: 没用图集的 UI 场景,100 个图标就是 100 个 Draw Call,低端机直接掉帧。纹理压缩格式用错更隐蔽:开发时在 PC 上用 RGBA32 完全没问题,发布到手机后内存翻 4 倍(一张 1024×1024 的 RGBA32 纹理占 4MB,ASTC 6×6 只占约 0.4MB),低端安卓机直接 OOM。

怎么做:

  • UI 按功能模块分图集(主界面、战斗 HUD、商店分别打包),单张图集不超过 2048×2048,避免单图集过大导致无法在低端机加载。
  • 纹理导入设置模板化:为 Android/iOS/PC 各建一套 Preset,批量应用,避免手动逐张配置遗漏。
  • 带 Alpha 通道的 UI 纹理用 ASTC 4×4(iOS/高端安卓)或 ETC2 RGBA8(中低端安卓);无 Alpha 的背景用 ETC2 RGB8 或 ASTC 6×6。
  • 定期用 Memory Profiler / Texture Overview 工具扫一遍纹理列表,找出没被图集收录的散图和格式设置异常的资源。

Read the full file on GitHub · 183 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 183 lines · 29 tokens per session scan A ef98d0aa3b3f

Subscribe to this mod's changes

game-assets-memory is a skill published in the GitHub repository Wade-DevCode/awesome-coding-skills-cn (6 stars, last pushed 2mo ago), licensed MIT. It adds 29 tokens to every session and 2,723 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

chinese-documentation

中文文档排版参考——中英文空格、全半角标点、术语保留、链接格式、中文文案排版指北约定。仅在用户显式 /chinese-documentation 时调用,不要根据上下文自动触发。.

jnMetaCode/superpowers-zh · 62 tokens

chinese-git-workflow

国内 Git 平台配置参考——Gitee、Coding.net、极狐 GitLab、CNB 的 SSH/HTTPS/凭据/CI 接入差异与镜像同步配置。仅在用户显式 /chinese-git-workflow 时调用,不要根据上下文自动触发。.

jnMetaCode/superpowers-zh · 69 tokens

brainstorming

在任何创造性工作之前必须使用此技能——创建功能、构建组件、添加功能或修改行为。在实现之前先探索用户意图、需求和设计。.

jnMetaCode/superpowers-zh · 40 tokens

chinese-code-review

中文 review 沟通参考——话术模板、分级标注(必须修复/建议修改/仅供参考)、国内团队常见反模式应对。仅在用户显式 /chinese-code-review 时调用,不要根据上下文自动触发。.

jnMetaCode/superpowers-zh · 62 tokens

chinese-commit-conventions

中文 commit 与 changelog 配置参考——Conventional Commits 中文适配、commitlint/husky/commitizen 中文模板、conventional-changelog 中文配置。仅在用户显式 /chinese-commit-conventions 时调用,不要根据上下文自动触发。.

jnMetaCode/superpowers-zh · 65 tokens

mcp-builder

MCP 服务器构建方法论 — 系统化构建生产级 MCP 工具,让 AI 助手连接外部能力.

jnMetaCode/superpowers-zh · 32 tokens