Communitygithub.com

unity-technologies/audio-setup-mixers

シーン内のAudio Sourceとオーディオアセットをスキャンし、既存のAudio Mixer Groupに適切にルーティングします。各ソースをその再生内容に基づいて分類します。ミキサーやグループの作成、音量設定は自動化せず、既存のものを整理してユーザーに不足分の追加を促します。

audio-setup-mixers とは?

このスキルは、Unityエディタで動作中のAudio Sourceを既存のAudio Mixer Groupにルーティングする作業を自動化します。具体的には、シーン内のAudio Sourceコンポーネントをスキャンし、各ソースが再生するアセットの名前(例:「FootStep4_Sound」→「Foley」)に基づいて適切なカテゴリを推測し、既存のグループにマッピングします。ただし、新しいAudio Mixerやグループの作成、音量設定は非公開APIに依存するため自動化しません。ユーザーが手動で不足するグループを作成した後、ルーティングのみを実行します。このスキルは、`unity-cli`スキルを介して動作中のUnityエディタにC#コードを注入することで機能します。ルーティング中にグループが見つからない場合やマッピング漏れがあった場合は報告し、ユーザーに確認を求めます。すべてのルーティングは単一のUndo操作でまとめられ、シーン保存が必要です。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/unity-technologies/skills/tree/main/skills/audio-setup-mixers

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Audio Mixer のセットアップ

Audio Source をミキサーグループにルーティングすることは、実行中のエディタでのみ可能なシーン編集です。そのため、このスキルでは C# を実行可能なライブエディタが必要です。ステップ 0 でその前提を確立します。

このスキルが自動化することと、ユーザーに委ねること。 ミキサーの検査と Audio Source のグループへのルーティングは完全にパブリックな Unity API で実行可能であり、これが最も面倒な部分です——数十のソースを調べ、それぞれが再生する内容に基づいて分類します。しかし、ミキサーやグループの作成にはパブリック API が存在しません。これらの操作は、Unity が安定性を保証しない型にのみ依存しています。そのため、このスキルは裏でグループを作成することはありません。既存のグループを調査し、ルーティング案を提案し、不足するグループがあれば Audio Mixer ウィンドウでユーザーが追加するよう促し、その後すべてのルーティングを自動実行します。

これは意図的な制限であり、回避すべきギャップではありません。リフレクションを使ってグループを作成したり、.mixer ファイルを手動で編集したりしないでください。ミキサー構造は、盲目的に安全に編集できるものではありません。

ステップ 0: エディタで C# を実行できることを確認する

後続のすべての C# ステップは、Unity CLI を介してライブエディタ内で実行されます。unity-cli スキルがその環境を構築します——CLI のインストール、接続されたエディタの確認、プロジェクトへの com.unity.pipeline パッケージの追加、実際に存在しないエディタとセーフモードでスタックしているエディタの区別、エディタのコマンドカタログの検出などです。まずそのスキルに従ってください。ここでそれを再導出しないでください。

このスキルが代わりに判断できないことが 2 つあります:

  • 特に eval が必要です、単に到達可能なエディタだけではありません。カタログに eval が表示されていることを確認してください。その有無は CLI ではなく Pipeline パッケージのバージョンに依存するため、正常にインストールされていても欠落している可能性があります。欠落している場合はその旨を伝えて停止してください。
  • .mixer ファイルを手動で編集する代替手段に頼らないでください。 ミキサールーティングは盲目的に安全に編集できるものではないため、エディタに到達できない場合は停止であり、即興で対応する合図ではありません。

eval が利用可能になれば、後続の各 C# ステップはそれを介して実行されます。

接続されたエディタで eval コマンドを使用して C# を実行します。そのパラメータ形式は unity command --format json で確認し、仮定しないでください。インライン形式は unity command eval --code '<snippet>' であり、一部の Pipeline バージョンではファイルからスニペットを実行するための eval_file も登録されています。eval_file に頼る前にカタログを確認してください。頻繁に欠落しています。 unity command のデフォルトタイムアウトは 30 秒です。

eval に C# を渡す

eval は ステートメントブロック をコンパイルします。ファイルではありません。これにより 2 つの結果が生じ、どちらも警告ではなくコンパイルエラーになります:

  • using ディレクティブは使用できません。 コンパイラは using UnityEngine; をリソース破棄ステートメントと解釈し、拒否します (CS0210)。
  • 型は完全修飾名で指定する必要があります。 裸の AssetDatabase や Volume は解決されず (CS0246 / CS0103)、裸の Object は object と曖昧になります (CS0104)。

以下のスニペットがファイルとして記述されている場合——可読性のために using を含めたり、プロジェクトに保存することを意図している場合——eval に渡す前に型を修飾してください。

ステップ 1: 事前確認

ユーザーが明示的に Audio Mixer を要求していない場合、セットアップを進めてよいか確認します。

次に、references/api.md のミキサーインベントリスニペットを使用して、既存のミキサーを調査します。ステップ 0 で説明したようにエディタを介して実行します。これにより、プロジェクト内のすべてのミキサーと各ミキサーのグループ名が取得できます。

これは親子ツリーではなくグループのフラットリストを返します。ルーティングには十分であり、パブリック API が公開するのはこれだけです。階層が会話の上で重要であれば、ユーザーに Audio Mixer ウィンドウを見て説明するよう依頼してください。非公開のツリー API に手を出して調べないでください。

プロジェクトにミキサーがまったくない場合、 即興で作成せずにその旨を伝えて停止します。ミキサーの作成にはパブリック API がありません。ユーザーにミキサーを作成するよう依頼してください (Window → Audio → Audio Mixer、次に Mixers の横の +)。作成され次第、ここから再開します。

ステップ 2: シーン内の参照を見つける

すべての Audio Source コンポーネントを見つけ、割り当てられたジェネレーターアセット名を確認し、サウンド名に適したクラスまたはカテゴリを一般化します。理想的には既存のものを使用します。 Audio Clip アセット名の例:

  • "FootStep4_Sound" -> Foley
  • "Dialogue_Female_Scene4" -> Vox/Voice/Dialogue
  • "GunShot" -> SFX
  • "Menu_Theme_Variation" -> Music

割り当てられたアセットが説明的でない場合や存在しない場合は、GameObject 名や隣接する MonoBehaviour の名前を確認してみます。 Audio Source の使用方法の分類が難しい、または信頼性が低い場合は、Uncategorized グループを作成するよう依頼します。

ステップ 3: グループリストの合意と不足グループの作成

ステップ 2 の分類を提案として提示します——各 Audio Source とそれをルーティングする予定のグループ——そしてユーザーと一緒に修正します。

先に進む前にユーザーの応答を待ちます。

既存のグループがそのカテゴリを適切にカバーしている場合は、たとえ自分なら別の名前を付けていたとしても、そちらを優先します。ただし、ミキシングエンジニアなら分けて管理するカテゴリを統合しないでください——Foley は SFX のサブセットであり、単なる別名ではありません。したがって、既存の Foley グループがあるからといって、銃声をそこにルーティングしてはいけません。既存のグループがカテゴリを部分的にしかカバーしていない場合は、どのグループが適合し、どのグループに新しいグループが必要かを伝え、ユーザーに判断を委ねます。

一致するグループがないカテゴリについては、グループを作成できません——そのためのパブリック API はありません。references/api.md の最後に示されているように、ミキサー名と正確なグループ名を具体的にユーザーに伝えます。その後、インベントリスニペットを再実行してグループが存在し、スペルが正しいことを確認してからルーティングします。ユーザーが実行したことを前提とせず、こちらが依頼したとおりにスペルしたことを前提としないでください。

ステップ 4: Audio Source のルーティング

グループリストが確定し、存在が確認されたら、references/api.md のルーティングスニペットを使用して各 Audio Source の出力グループを割り当てます。これはすべてパブリック API であり、全体の処理を単一の Undo ステップでラップするため、ユーザーは一度にすべてを元に戻せます。

分類に使用した識別子でマッピングをキー設定します。 ステップ 2 はまずクリップアセット名を読み、それがない場合のみ GameObject 名にフォールバックするため、マッピングは両方を受け付けます。これらは異なる識別子であり、間違った方でキー設定するとソースがドロップされます。

以下の 3 点については、仮定せずに報告します:

  • スニペットが返す NO SUCH GROUP エントリ。 これは、期待したグループがミキサーに存在しないことを意味します——通常はスペルの違いです。ユーザーと解決し、ソースを黙ってスキップしないでください。
  • NOT IN THE MAPPING エントリ。 これらは分類から漏れた Audio Source です。成功したルーティングを報告しながらソースが静かに未ルーティングのままになるのは最悪の結果です。成功と受け取られるからです。
  • シーンが変更されたのであって、ミキサーアセットではないこと。 ルーティングは Audio Source に保存されるため、シーンが保存されるまで永続しません。ユーザーにその旨を伝え、同意がある場合のみ保存します。

ボリューム、エフェクト、親子構造の変更は対象外です。 これらは非公開 API に依存します。ユーザーが要求した場合は、ルーティングは完了したと伝え、ミキシング自体については Audio Mixer ウィンドウを参照するよう指示します。

参考情報

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.

関連スキル