Communitygithub.com

unity-technologies/audio-setup-mixers

掃描場景與音訊資產,將音訊來源適當地路由至現有的音訊混音器群組,並依播放內容分類每個來源。當使用者詢問清理混音器指派、透過混音器路由音訊,或某個聲音屬於哪個群組時使用。建立混音器與群組、設定音量不在自動化範圍內——此技能僅盤點現有項目,並要求使用者補充遺漏的部分。

audio-setup-mixers 是什麼?

此 Unity 技能(適用於 Claude Code、Cursor、Codex 等 AI 代理)自動化將 Audio Sources 路由至現有 Audio Mixer Groups 的繁瑣工作,為音訊設計師與開發者節省大量時間。它透過掃描場景中的所有 Audio Source 元件,分析其音訊資產名稱(如「FootStep4_Sound」→「Foley」)或 GameObject 名稱來分類每個來源,並將分類結果與現有群組比對,提出路由建議。技能僅使用公開 Unity API,無法自動建立混音器或群組(因缺少公開 API),因此會在路由前要求使用者手動建立缺失的群組。此技能專為 Unity Editor 設計,需透過 unity-cli 技能建立與執行 C# 程式碼的連線,才能進行場景編輯。它支援所有 Unity 版本,但依賴 `com.unity.pipeline` 套件提供的 `eval` 命令,因此能安全地處理混音器路由,同時避免不支援的作業(如編輯 `.mixer` 檔案)。技能遵循四步驟流程:確認使用者意圖、盤點現有混音器與群組、分類場景中的 Audio Sources、協商並執行路由。它會清楚報告遺漏的群組或未分類的來源,並將路由包裝在單一復原步驟中,方便使用者一次恢復所有變更。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/unity-technologies/skills/tree/main/skills/audio-setup-mixers

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

音訊混音器設定

將音訊來源路由至混音器群組是一項場景編輯動作,只能在執行中的 Editor 中進行,因此此技能需要一個可執行 C# 的即時 Editor。步驟 0 會在任何其他動作之前先確立此事。

此技能自動化的事項,以及它交回給您處理的部分。 檢查混音器並將音訊來源路由至群組完全是公開的 Unity API,而這正是最繁瑣的部分——逐一檢視數十個來源並依播放內容分類。建立混音器或群組則沒有公開 API;它僅存在於 Unity 不定義為穩定類型的型別中。因此此技能不會在未告知的情況下建立群組。它會盤點現有項目、提出路由方案、要求您在音訊混音器視窗中新增任何缺失的群組,然後自行完成所有路由工作。

這是刻意的限制,而非需要繞過的缺口。請不要使用反射來建立群組,也不要手動編輯 .mixer 檔案——混音器結構無法在不確實了解的情況下安全地建立。

步驟 0:確認您能在 Editor 中執行 C#

以下的每個 C# 步驟都透過 Unity CLI 在即時 Editor 中執行。unity-cli 技能負責引導您完成此過程——安裝 CLI、確認已連線的 Editor、新增專案的 com.unity.pipeline 套件、區分真正缺失的 Editor 與卡在安全模式的 Editor,以及探索 Editor 的命令目錄。請先遵循該技能,不要在此重新推導任何內容。

有兩件事它無法為您確定:

  • 您特別需要 eval,而不僅僅是一個可達的 Editor。請確認它出現在目錄中。它的存在取決於 Pipeline 套件版本,而非 CLI,因此一個健康的安裝仍可能缺少它——如果缺失,請說明情況並停止。
  • 不要退而手動編輯 .mixer 檔案。 混音器路由無法在不確實了解的情況下安全地建立,因此無法連線的 Editor 就是停止信號,而非即興創作的提示。

一旦 eval 可用,上述每個 C# 步驟就會透過它執行。

透過已連線的 Editor 使用 eval 命令執行 C#。從 unity command --format json 發現其參數形狀,而非假設某種形式——內聯形式為 unity command eval --code '<snippet>',某些 Pipeline 版本也註冊了 eval_file 用於從檔案執行片段。在使用 eval_file 前請檢查目錄;它經常缺失。 unity command 預設逾時時間為 30 秒。

將 C# 傳遞給 eval

eval 編譯的是語句區塊,而非檔案。這會產生兩個後果,兩者都會導致編譯錯誤而非警告:

  • 沒有 using 指令。 編譯器會將 using UnityEngine; 解讀為資源釋放語句並拒絕(CS0210)。
  • 型別必須完整限定。 裸寫的 AssetDatabase 或 Volume 無法解析(CS0246 / CS0103),而裸寫的 Object 會與 object 產生歧義(CS0104)。

如果下方的片段是以檔案形式撰寫——帶有 using、為了可讀性,或因為它旨在儲存到專案中——請在傳遞給 eval 之前完整限定型別。

步驟 1:預檢

如果使用者沒有明確要求音訊混音器,請確認他們是否要繼續進行設定。

然後,使用 references/api.md 中的混音器盤點片段,按照步驟 0 所述透過 Editor 執行,盤點現有項目。這會提供您專案中的每個混音器以及每個混音器中的群組名稱。

它會傳回群組的扁平清單,而非父/子樹狀結構。這足以進行路由,而且也是公開 API 提供的全部內容。如果對話中需要階層結構,請要求使用者查看音訊混音器視窗並描述它——不要為了找出結果而接觸非公開的樹狀 API。

如果專案完全沒有混音器, 請說明情況並停止,而非即興建立一個:建立混音器沒有公開 API。要求使用者建立一個(視窗 → 音訊 → 音訊混音器,然後混音器旁的 +),等完成後再從這裡繼續。

步驟 2:尋找場景參考

找出所有音訊來源元件,查看其指派的 Generator 資產名稱,並歸納出一個合適的分類或類別,最好使用已存在的名稱。

音訊剪輯資產名稱範例:

  • "FootStep4_Sound" -> Foley
  • "Dialogue_Female_Scene4" -> Vox/聲音/對話
  • "GunShot" -> SFX
  • "Menu_Theme_Variation" -> 音樂

如果指派的資產不具描述性或不存在,請嘗試查看 GameObject 名稱或相鄰的 MonoBehaviour 名稱。

如果難以分類或對某個音訊來源的使用方式信心不足,請要求建立一個「未分類」群組。

步驟 3:商定群組清單,並建立任何缺失的群組

將步驟 2 的分類結果呈現為一個建議的路由方案——每個音訊來源以及您打算將其發送至的群組——並與使用者一起修訂。

在繼續之前,請等待使用者回應。

當現有群組確實涵蓋該類別時,應優先使用它,即使您原本會用不同的名稱命名。但不要合併混音工程師會分開處理的類別——Foley 是 SFX 的子集,而非其同義詞,因此即使存在 Foley 群組,槍聲也不應歸入其中。當現有群組僅部分涵蓋您的類別時,請說明哪些符合、哪些需要新群組,並讓使用者決定。

對於沒有相符群組的類別,您無法建立群組——沒有公開 API。請精確地移交該任務,指明混音器名稱和確切群組名稱,如 references/api.md 結尾所示。然後重新執行盤點片段以確認群組存在並檢查其拼寫,然後再進行路由。不要假設使用者已完成此操作,也不要假設他們按照您要求的方式拼寫。

步驟 4:路由音訊來源

在群組清單確定並確認存在後,使用 references/api.md 中的路由片段為每個音訊來源指派輸出群組。它全程使用公開 API,並將整個過程包裝在單一復原步驟中,方便使用者一次恢復所有變更。

根據您分類時使用的識別碼進行映射。 步驟 2 首先讀取音訊剪輯資產名稱,只有在此名稱不足時才退而使用 GameObject 名稱,因此映射接受兩者——這兩個是不同的識別碼,使用錯誤的識別碼會導致來源被遺漏。

需要回報而非假設的三件事:

  • 片段傳回的任何 NO SUCH GROUP 條目。 這表示您預期的群組不在混音器中——通常是拼寫差異。請與使用者解決此問題,不要默默地跳過該來源。
  • 任何 NOT IN THE MAPPING 條目。 這些是您的分類遺漏的音訊來源。在來源被悄悄遺留未路由的情況下報告路由成功是最糟的結果,因為這會被解讀為成功。
  • 場景已被修改,而非混音器資產。 路由資訊儲存在音訊來源上,因此只有在場景儲存後才會持久化。請告知使用者,並僅在獲得使用者同意後才儲存。

音量、效果和重新父子關係不在範圍內。 這些依賴非公開 API。如果使用者提出要求,請告知路由已完成,並引導他們前往音訊混音器視窗進行混音本身。

參考資料

請參閱 references/api.md

Individual skills in this repo

This repo contains 9 individual skills — each has its own dedicated page.

unity-technologies/2d-pixel-perfect

Sets up, diagnoses, and fixes pixel perfect 2D rendering in Unity projects. Use when working on any retro-style or pixel art 2D game.

unity-technologies/build-live-game

Build and operate a live game using Unity Services. Use when the user needs to implement, connect, or debug backend-driven features — battle passes, achievements, player progression, cloud saves, leaderboards, matchmaking, virtual economies, server-authoritative logic, anti-cheat, player accounts and authentication, remote configuration, feature flags, A/B testing, analytics, or cloud resource deployment. Triggers on live-ops, live service, backend, server authority, cloud code, cloud save, remote config, player data, retention, monetization loop, season pass, ranking, multiplayer sessions, lobbies, or any Unity Services integration.

unity-technologies/generate-editor-search-query

Generates Unity Search / Quick Search queries and opens the Unity Search window for read-only Unity Editor asset or scene-object lookup requests. Always use when the user asks to find, search, show, locate, filter, look up, query, or list concrete assets or scene objects in the current project or scene, even if Unity Search is not named. Covers materials, textures, prefabs, scenes, scripts, shaders, GameObjects, components, Lights, Cameras, UI objects, labels, paths, references, selected or named assets, and asset types. Also use when the user explicitly mentions Unity Search, Quick Search, Search window, open Search, or asks what Unity Search query to use. Do not use for general project overview, project structure, folder-purpose summaries, gameplay/system explanations, how-to programming questions, web search, repository text search, build logs, package installation, menu or settings search, modifying results, or non-Unity filesystem search unless the user explicitly asks to use Unity Search.

unity-technologies/implement-in-app-purchases

Implement, configure, and debug Unity In-App Purchases (IAP) — store connection, product catalog, consumable/non-consumable/subscription purchases, two-step pending-confirm flow, receipt validation, entitlement checking, restore transactions, Apple extensions (promotional purchases, Ask-to-Buy, code redemption), and Google Play extensions (subscription upgrade/downgrade), D2C Capabilities(direct to customer), 3rd party payment provider (Stripe/Coda) via Unity IAP/Unity Cloud. Use when the user needs to add, modify, debug, or migrate from native Android/iOS billing, 3rd party packages(RevenueCat/Adapty/Essential Kit/Unipay supported) to IAP. Triggers on microtransactions (MTX), monetization, real-money purchases, store purchases, buying items, support D2C, purchase via Stripe/Coda, migrate from native billing(Google's BillingClient or Apple's StoreKit/SKPaymentQueue/SKProduct)/RevenueCat/Adapty/EssentialKit/Unipay.

unity-technologies/initialize-ai-navigation

Sets up and configures the Unity AI Navigation system — NavMesh surfaces, NavMesh agents, obstacles, links, modifiers, areas and costs. Use when creating walkable navigation meshes, adding pathfinding agents, setting up patrol routes, configuring obstacle avoidance and carving, connecting separate NavMeshes with links, coupling navigation with animation, or troubleshooting navigation issues.

unity-technologies/levelplay-unity-integration

Integrates the LevelPlay Mediation SDK via the Ads Mediation UPM package. Use when a developer asks about adding ads to a Unity game, implementing rewarded, interstitial, or banner ads, setting up ad mediation, configuring ad networks, installing or updating the Ads Mediation package, troubleshooting LevelPlay namespace errors, resolving Android gradle or iOS CocoaPods dependency issues for ads, configuring ATT or privacy settings for ad compliance, tracking impression-level revenue (ILRD), initializing the LevelPlay SDK, or setting up ad unit IDs. Also use when a developer wants to monetize their Unity game with ads, asks how to get started with LevelPlay, ads, or mediation, or needs help with any part of the LevelPlay integration workflow including platform-specific setup for iOS or Android. Also use when upgrading the LevelPlay or IronSource SDK version, migrating from deprecated IronSource.Agent APIs, or migrating a game from Unity Ads to LevelPlay.

unity-technologies/localization

Sets up and configures Unity Localization, including locales, String/Asset Tables, CJK font support, and Addressables workflows. Use when the user wants to add languages to a project, translate UI text, support Asian (CJK) languages with TMP fonts, or mentions i18n, l10n, multilingual support, or making a game support multiple languages.

unity-technologies/manage-sprite-atlas

Manage SpriteAtlas using prebuild pipeline with IPreprocessBuildWithReport (DEFAULT approach). Use it to configure master atlases, variant atlases, texture settings, packing settings, and platform-specific configurations. Use when the user asks about creating sprite atlases, optimizing sprites, configuring atlas settings, adding sprites to atlases, creating variant atlases, implementing automated atlas generation, or runtime sprite atlas access. Always use prebuild approach unless user explicitly requests manual authoring.

unity-technologies/migrate-birp-to-urp

Plans, executes, and troubleshoots Unity projects moving from the Built-in Render Pipeline (BiRP/BIRP/Built-in RP) to the Universal Render Pipeline (URP). Use when the user asks to upgrade, convert, switch, or migrate a project, scene, material, or shader to URP/Universal Render Pipeline; fix pink or magenta materials after URP; convert Built-in materials/shaders; move a 2D project to URP 2D; review lighting, quality, post-processing, baked lightmaps, or reflection probes after URP; or diagnose visual problems after a render-pipeline migration.

相關技能