PatchAudio: Simple BG Crossfader
v1.0.0 · Updated 11/3/2025
Overview
Simple BG Crossfader provides a tiny component to crossfade background tracks without clicks or abrupt changes. It manages two channels and fades volume between them using a coroutine.
Installation
- Import the unitypackage into your Unity project.
- Add the Crossfader component to a GameObject in your scene.
- Assign two AudioSources (A/B) for crossfading.
Demo Project Structure
This folder contains a minimal demo for the Simple BGM Crossfader.
Contents:
-
Scenes/DemoCrossfader.unity Example scene showing how to set up the crossfader in a Unity scene.
-
Audios/ Place your own test audio files here. Suggested names: TitleIntro.wav (optional, plays once before looping) TitleLoop.wav (main loop for title screen) GameplayLoop.wav (loop for gameplay background)
-
BgmDefinitions/ Store BgmDefinition assets here.
How to Test the Demo
-
Copy your audio files into Demo/Audios/ (WAV/OGG recommended). Example:
- TitleIntro.wav
- TitleLoop.wav
- GameplayLoop.wav
-
Create BgmDefinition assets:
- Right-click in the Project window → Create → PatchAudio → BGM Definition
- For "Title Bgm": • Intro = TitleIntro.wav (optional) • Loop = TitleLoop.wav
- For "Gameplay Bgm": • Loop = GameplayLoop.wav
-
Open Scenes/DemoCrossfader.unity
-
Select the "DemoController" GameObject in the scene.
- Drag your TitleBgm.asset into the Title Bgm field.
- Drag your GameplayBgm.asset into the Gameplay Bgm field.
-
Press Play.
- The demo will start playing the Title BGM.
- You can trigger crossfade to the Gameplay BGM using the provided script.

