gamedev-unity/skills/unity-skills/skills/optimization/SKILL.md
Optimize project assets and scenes — batch texture/mesh/audio compression and analyze poly/material counts. Use when reducing build size, batch-compressing assets, or analyzing scene poly and material usage for optimization, even if the user just says "优化资源" or "包体太大". 优化工程资源与场景(批量压缩 texture/mesh/audio、分析面数/材质数);当用户要缩减包体、批量压缩资源、或分析场景面数与材质用量以优化时使用。
npx skillsauth add bernatmv/ai-rules unity-optimizationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Optimize project assets (Textures, Models).
optimize_analyze_scene / optimize_find_large_assets / optimize_get_static_flags / optimize_find_duplicate_materials / optimize_analyze_overdraw,标 SkillMode.SemiAuto)直接执行;写型 skill(optimize_textures / optimize_mesh_compression / optimize_audio_compression / optimize_set_static_flags / optimize_set_lod_group,默认 SkillMode.FullAuto)需用户 grant,grant 后一步执行返结果。IsForbiddenInSemi 拦截。批量操作前务必检查筛选范围(filter / assetType),改完无 dry-run 回滚。DO NOT (common hallucinations):
optimize_scene / optimization_run do not exist → use specific skills: optimize_analyze_scene, optimize_find_large_assets, optimize_find_duplicate_materials, etc.optimize_compress / optimize_compress_textures / optimize_compress_meshes / optimize_compress_audio do not exist → use optimize_textures (textures), optimize_mesh_compression (meshes), optimize_audio_compression (audio)optimize_set_lod / optimize_setup_lod do not exist → use optimize_set_lod_groupRouting:
profiler moduleoptimize_set_static_flags (this module)performance advisory moduleoptimize_texturesOptimize texture settings (maxSize, compression). Returns list of modified textures.
| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | maxTextureSize | int | No | 2048 | Max texture size | | enableCrunch | bool | No | true | Enable crunch compression | | compressionQuality | int | No | 50 | Compression quality 0-100 | | filter | string | No | "" | Asset filter |
Returns: { success, count, message, modified }
optimize_mesh_compressionSet mesh compression for 3D models.
| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | compressionLevel | string | No | "Medium" | Compression level: Off/Low/Medium/High | | filter | string | No | "" | Asset filter |
Returns: { success, count, compression, modified }
optimize_analyze_sceneAnalyze scene for performance bottlenecks (high-poly meshes, excessive materials).
| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | polyThreshold | int | No | 10000 | Triangle count threshold for high-poly warning | | materialThreshold | int | No | 5 | Material slot count threshold for excessive materials warning |
Returns: { success, totalRenderers, totalTriangles, totalMaterialSlots, issueCount, issues }
optimize_find_large_assetsFind assets exceeding a size threshold (in KB).
| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | thresholdKB | int | No | 1024 | Size threshold in KB | | assetType | string | No | "" | Asset type filter (e.g. Texture2D, AudioClip) | | limit | int | No | 50 | Maximum number of results |
Returns: { success, threshold, count, assets }
optimize_set_static_flagsSet static flags on GameObjects. flags: Everything/Nothing/BatchingStatic/OccludeeStatic/OccluderStatic/NavigationStatic/ReflectionProbeStatic
| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | name | string | No | null | GameObject name | | instanceId | int | No | 0 | GameObject instance ID | | path | string | No | null | GameObject hierarchy path | | flags | string | No | "Everything" | Static flags to set | | includeChildren | bool | No | false | Apply to all children recursively |
Returns: { success, gameObject, flags, affectedCount }
optimize_get_static_flagsGet static flags of a GameObject.
| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | name | string | No | null | GameObject name | | instanceId | int | No | 0 | GameObject instance ID | | path | string | No | null | GameObject hierarchy path |
Returns: { success, gameObject, flags, isStatic }
optimize_audio_compressionBatch set audio compression. compressionFormat: PCM/Vorbis/ADPCM. loadType: DecompressOnLoad/CompressedInMemory/Streaming
| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | compressionFormat | string | No | "Vorbis" | Audio compression format: PCM/Vorbis/ADPCM | | loadType | string | No | "CompressedInMemory" | Audio load type: DecompressOnLoad/CompressedInMemory/Streaming | | quality | float | No | 0.5 | Compression quality 0.0-1.0 | | filter | string | No | "" | Asset filter |
Returns: { success, count, compressionFormat, loadType, modified }
optimize_find_duplicate_materialsFind materials with identical shader and properties.
| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | limit | int | No | 50 | Maximum number of duplicate groups to return |
Returns: { success, duplicateGroups, groups }
optimize_analyze_overdrawAnalyze transparent objects that may cause overdraw.
| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | limit | int | No | 50 | Maximum number of results |
Returns: { success, transparentObjectCount, objects }
optimize_set_lod_groupAdd or configure LOD Group. lodDistances: comma-separated screen-relative heights (e.g. '0.6,0.3,0.1')
| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | name | string | No | null | GameObject name | | instanceId | int | No | 0 | GameObject instance ID | | path | string | No | null | GameObject hierarchy path | | lodDistances | string | No | "0.6,0.3,0.1" | Comma-separated screen-relative transition heights |
Returns: { success, gameObject, lodLevels, distances }
Exact names, parameters, defaults, and returns are defined by GET /skills/schema or unity_skills.get_skill_schema(), not by this file.
development
Keyword research and validation with real search-demand data — never ship keywords from intuition alone. Probes Google Autocomplete per language (free, no account) to prove demand and discover the exact phrasing people type, checks SERPs for winnability, and uses Keyword Planner/Ahrefs/Semrush exports when the user has access. Activates when: choosing or reviewing SEO keywords, meta keywords, page titles, article topics or slugs, landing page copy targeting search, App Store/ASO keyword fields, multilingual keyword sets, 'what should we rank for', 'keyword analysis', or auditing why a page doesn't rank. Also invoke it as a validation pass whenever another skill or task produces a keyword list.
development
Automate YooAsset hot-update and asset bundles — build bundles, run Editor simulate builds, manage Collector groups, analyze BuildReport, and validate runtime. Use when building or simulating YooAsset bundles, configuring collectors, or validating hot-update assets, even if the user just says "热更" or "打AB包". 自动化 YooAsset 热更新与资源包(构建 bundle、编辑器模拟构建、管理 Collector 分组、分析 BuildReport、运行时校验);当用户要构建或模拟 YooAsset 资源包、配置 collector、或校验热更资源时使用。
development
Source-anchored design rules for YooAsset v2.3.18 — initialization, default-package shortcuts, play modes, asset handles, loading, updates, filesystem, build, and pitfalls. Use when writing or reviewing YooAsset code, initializing packages, loading assets via handles, setting up hot-update/download, or choosing a play mode, even if the user just says "热更" or "资源包". 为 YooAsset v2.3.18 提供源码锚定的设计规则(初始化、默认包快捷方式、运行模式、资源句柄、加载、更新、文件系统、构建、陷阱);当用户要编写或审查 YooAsset 代码、初始化 package、用句柄加载资源、配置热更/下载、或选择运行模式时使用。
data-ai
Last-resort guidance for safely hand-editing Unity serialized YAML (.unity/.prefab/.asset/.meta/ProjectSettings) — reference/fileID repair, GUID safety, and merge-conflict fixes. Use when REST cannot reach the change and YAML must be hand-edited — fixing m_Script GUIDs, broken fileID references, .meta files, or merge conflicts, even if the user just says "场景文件打不开" or "引用丢了". 安全手编 Unity 序列化 YAML(.unity/.prefab/.asset/.meta/ProjectSettings)的最后手段(引用/fileID 修复、GUID 安全、合并冲突修复);当 REST 无法触达、必须手编 YAML 时使用——修复 m_Script GUID、断裂 fileID 引用、.meta 文件或合并冲突。