name: unity-audio-source-inspection description: Use this skill when inspecting or debugging Unity AudioSource components, AudioClip assignments, Audio Mixer routing, SFX playback, music/SFX separation, spatial blend, Play On Awake, looping, volume, priority, duplicated AudioSources, missing references, or script-driven audio behavior in scenes, prefabs, and gameplay objects.
Unity AudioSource Inspection
Use this skill to inspect Unity AudioSource setup safely.
The goal is to find and fix audio problems caused by incorrect AudioSource configuration, missing references, bad mixer routing, duplicate playback, incorrect 2D/3D settings, bad loop/play settings, or unsafe script-triggered audio behavior.
Scope
Allowed:
- Inspect AudioSource components.
- Inspect AudioClip assignments.
- Inspect Audio Mixer group routing.
- Inspect prefabs and scene objects for audio configuration issues.
- Inspect scripts that trigger AudioSource playback.
- Detect duplicate or competing AudioSources.
- Detect missing or null audio references.
- Recommend Inspector changes clearly.
- Make localized script fixes when requested.
Allowed only when explicitly requested:
- Editing prefabs.
- Editing scene objects.
- Changing AudioSource serialized values.
- Changing Audio Mixer assets.
- Changing AudioClip import settings.
- Replacing audio architecture.
- Creating new audio managers.
- Reassigning clips or mixer groups.
Not allowed:
- Editing
.metafiles. - Replacing existing prefabs.
- Creating broad audio refactors without approval.
- Changing unrelated UI, gameplay, animation, or VFX logic.
- Claiming Unity Play Mode audio was tested unless it actually was.
Inspection Checklist
When investigating an AudioSource issue, check:
- Which GameObject owns the AudioSource.
- Whether the AudioSource is on a scene object, prefab, child object, or runtime-instantiated object.
- Whether the AudioSource has an assigned AudioClip.
- Whether the script uses
Play,PlayOneShot,Stop,Pause,UnPause, orclip = .... - Whether
Play On Awakeis enabled correctly. - Whether
Loopis enabled correctly. - Whether the AudioSource is routed to the correct Audio Mixer Group.
- Whether the source is meant to be Music, SFX, UI, Ambience, Voice, or Ability audio.
- Whether
Spatial Blendshould be 2D or 3D. - Whether volume/pitch/priority settings are sane.
- Whether min/max distance and rolloff are correct for 3D audio.
- Whether multiple AudioSources play the same sound at once.
- Whether audio playback is triggered every frame or too frequently.
- Whether missing serialized references can cause NullReferenceException.
- Whether the object is disabled/destroyed before the clip can finish.
- Whether pooling affects playback lifecycle.
- Whether an AudioListener exists and is not duplicated.
Common Problems To Detect
Look specifically for:
- Missing AudioClip reference.
- Missing AudioSource reference in script.
- AudioSource exists but is disabled.
- AudioSource GameObject is inactive.
Play On Awakeenabled on SFX that should only play on action.Play On Awakedisabled on ambience/music that should start automatically.Loopenabled on one-shot SFX.Loopdisabled on music/ambience/continuous ability audio.- SFX routed to Music mixer group.
- Music routed to SFX mixer group.
- UI sound routed to world SFX group.
- 3D sound configured as 2D.
- UI/global sound configured as 3D.
- Very high volume causing clipping.
- Multiple AudioSources on parent/child playing the same effect.
- Duplicate AudioListeners.
Play()called repeatedly and restarting the clip.PlayOneShot()called too frequently and stacking.- Runtime-created AudioSources not cleaned up.
- AudioSource destroyed before clip finishes.
- Same clip assigned to several gameplay systems unintentionally.
- Animation Events and scripts both trigger the same sound.
AudioSource Configuration Rules
Use these defaults unless the project clearly requires otherwise.
One-shot gameplay SFX
Recommended:
Play On Awake: falseLoop: falseSpatial Blend: usually 0 for UI/global, 1 for world-positioned SFX- Playback method:
PlayOneShot - Add cooldown/throttle if the action can repeat quickly
- Route to SFX mixer group
Music
Recommended:
- Dedicated AudioSource
Loop: depends on playlist systemSpatial Blend: 0- Route to Music mixer group
- Do not restart music unnecessarily between scenes unless intended
- Do not use gameplay SFX sources for music
UI sounds
Recommended:
Spatial Blend: 0Play On Awake: falseLoop: false- Route to UI or SFX mixer group
- Trigger from UI events only
Ambience
Recommended:
- Usually looped
- Usually 2D for global ambience or 3D for positional ambience
- Route to Ambience or SFX mixer group
- Avoid many overlapping ambience sources in the same location
Ability / combat looping sounds
Recommended:
- Start once when ability begins
- Stop once when ability ends/cancels
- Do not restart every frame
- Guard with
isPlayingor explicit state flag - Route to SFX or Ability mixer group
Script Inspection Rules
When inspecting scripts, look for these patterns:
Bad:
private void Update()
{
audioSource.Play();
}
Bad:
private void Update()
{
if (isAttacking)
audioSource.PlayOneShot(attackClip);
}
Better:
[SerializeField] private AudioSource sfxSource;
[SerializeField] private AudioClip attackClip;
[SerializeField] private float attackSfxCooldown = 0.18f;
private float _lastAttackSfxTime = -999f;
private void PlayAttackSfx()
{
if (sfxSource == null || attackClip == null)
return;
if (Time.time - _lastAttackSfxTime < attackSfxCooldown)
return;
_lastAttackSfxTime = Time.time;
sfxSource.PlayOneShot(attackClip);
}
For looping audio:
private void StartAbilityLoop()
{
if (abilitySource == null)
return;
if (abilitySource.isPlaying)
return;
abilitySource.loop = true;
abilitySource.Play();
}
private void StopAbilityLoop()
{
if (abilitySource == null)
return;
if (!abilitySource.isPlaying)
return;
abilitySource.Stop();
}
Mixer Routing Rules
When inspecting mixer routing:
- Music should route to Music.
- Player SFX should route to SFX or PlayerSFX.
- Enemy SFX should route to SFX or EnemySFX.
- UI sounds should route to UI or SFX.
- Ambience should route to Ambience or SFX.
- Do not leave important runtime AudioSources unrouted if the project uses Audio Mixer volume sliders.
- If a UI slider controls SFX but a sound ignores it, check whether the AudioSource is routed to the correct mixer group.
If the correct Audio Mixer Group cannot be confirmed:
- Do not guess silently.
- Report the source and current routing.
- Recommend the expected group based on sound type.
Duplicate AudioSource Audit
Check for duplicate playback sources:
- Same sound triggered from both script and Animation Event.
- Same clip assigned to parent and child objects.
- Multiple AudioSources on the same GameObject with overlapping responsibility.
- Prefab variant adds an AudioSource while base prefab already has one.
- Runtime instantiation creates a new AudioSource every time an action is used.
- Object pooling reuses sources without stopping previous playback.
When duplicates are found, report:
Duplicate AudioSource Risk:
- GameObject:
- Components:
- Clip:
- Trigger path:
- Why it may duplicate:
- Safe fix:
2D / 3D Spatial Audio Rules
Use 2D audio for:
- Music
- UI sounds
- Global feedback sounds
- Non-positional player feedback
- Menu sounds
Use 3D audio for:
- Enemy sounds
- World pickups
- Environmental objects
- Positional combat impacts
- Localized ambience
- Trader/NPC voice or interaction sounds if positional
For 3D audio, inspect:
- Spatial Blend
- Min Distance
- Max Distance
- Rolloff Mode
- Doppler Level
- Spread
- Priority
Avoid extreme Doppler unless specifically desired.
Beavermania-Specific Guidance
In Beavermania:
- Prefer localized fixes.
- Preserve existing namespaces:
Beavermania.AudioBeavermania.PlayerBeavermania.Player.CombatBeavermania.Player.MovementBeavermania.UIBeavermania.Core.Input
- Do not edit
BeaverInputSystem.cs; it is generated by Unity Input System. - Do not edit
.metafiles. - Do not replace prefabs or scene objects unless explicitly requested.
- Be careful with:
- player jump SFX
- slash SFX
- Hurricane / wind sounds
- FireBreath sounds
- electric ability sounds
- footsteps
- pickup sounds
- hurt/damage sounds
- music continuing from Menu into gameplay
- SFX volume slider behavior
- If serialized fields are added, list them clearly so they can be assigned in Unity Inspector.
- If mixer routing requires Inspector changes, report exact GameObject, AudioSource, and expected Output Mixer Group.
Required Investigation Output
Before fixing, produce a short inspection summary:
AudioSource Inspection:
- Suspected GameObject:
- AudioSource/component:
- Clip:
- Current symptom:
- Current trigger path:
- Current mixer routing:
- 2D/3D setup:
- Likely cause:
- Safe fix:
- Requires Unity Editor change: yes/no
Fix Strategy
Prefer this order:
- Fix missing/null-safe script references.
- Add cooldown/throttle if playback repeats too frequently.
- Fix
Play,PlayOneShot,Stop, or loop lifecycle logic. - Recommend AudioSource Inspector changes.
- Recommend Audio Mixer routing changes.
- Only then suggest broader audio architecture changes.
Avoid large refactors unless the user explicitly asks.
Validation Checklist
After changes, report:
- Files changed.
- AudioSources inspected.
- Audio issue found.
- Script changes made.
- Inspector changes required.
- Mixer routing changes required.
- Manual Play Mode checks.
Manual Play Mode test examples:
- Trigger the sound once and confirm it plays once.
- Spam the action and confirm audio does not stack or clip.
- Confirm SFX slider affects the sound if expected.
- Confirm music slider does not affect SFX unless designed.
- Confirm 3D sound attenuates correctly with distance.
- Confirm UI/global sounds are not affected by player position.
- Confirm no NullReferenceException appears in Console.
- Confirm no duplicate AudioListener warnings appear.
Final Response Format
When done, summarize:
- Files changed.
- GameObjects/AudioSources inspected.
- AudioSource issues found.
- Script fixes applied.
- Inspector assignments required.
- Mixer routing changes required.
- Manual Unity Play Mode checks.
Do not claim Unity Play Mode was tested unless it was actually run. Do not claim Inspector or Audio Mixer changes were made unless they were actually edited.