en un clic
f8-features-audio-workflow
// Use when implementing or troubleshooting Audio feature workflows — BGM, voice, SFX, 3D audio, volume control, and AudioMixer in F8Framework.
// Use when implementing or troubleshooting Audio feature workflows — BGM, voice, SFX, 3D audio, volume control, and AudioMixer in F8Framework.
Use when implementing or troubleshooting Tween feature workflows — tween animations, sequences, chain calls, UI relative motion, and coroutine/async support in F8Framework.
Use when implementing or troubleshooting ExcelTool feature workflows — config table loading, Excel binary/JSON generation, variant support, and runtime data access in F8Framework.
Use when working with Module editor tools — right-click context menu for creating Module, ModuleMono, StaticModule, and ActivityModule templates in F8Framework.
Use when implementing or troubleshooting Module feature workflows — ModuleCenter lifecycle, module creation, StaticModule, ActivityModule, update attributes in F8Framework.
Use as the routing skill for selecting the correct F8Framework layer skill chain across foundation, features, editor, tools, and build.
Use when working with Assembly Reflection tools — type discovery, reflection utilities, and assembly scanning in F8Framework.
| name | f8-features-audio-workflow |
| description | Use when implementing or troubleshooting Audio feature workflows — BGM, voice, SFX, 3D audio, volume control, and AudioMixer in F8Framework. |
⚠️ IMPORTANT: Before using this feature, you MUST formally initialize F8Framework in the launch sequence. Ensure
ModuleCenter.Initialize(this);has run first, then create the required module, for exampleFF8.Audio = ModuleCenter.CreateModule<AudioManager>();.
| Class | Role |
|---|---|
AudioManager | Core module. Access via FF8.Audio. |
AudioMusic | Background music player. |
AudioVoice | Voice/dialogue player. |
AudioEffect | SFX and UI sound player. |
FF8.Audio.PlayMusic("assetName", callback, loop: true, priority: 1, fadeDuration: 3f);
float progress = FF8.Audio.ProgressMusic;
FF8.Audio.SetProgressMusic = 0.5f;
FF8.Audio.VolumeMusic = 0.5f; // Auto-saves to PlayerPrefs
FF8.Audio.SwitchMusic = false; // Auto-saves to PlayerPrefs
FF8.Audio.SetMusicComplete(callback);
FF8.Audio.PlayVoice("assetName", callback, loop: true, priority: 1, fadeDuration: 3f);
float progressVoice = FF8.Audio.ProgressVoice;
FF8.Audio.SetProgressVoice = 0.5f;
FF8.Audio.VolumeVoice = 0.5f;
FF8.Audio.SwitchVoice = false;
FF8.Audio.SetVoiceComplete(callback);
FF8.Audio.PlayUISound("assetName", callback, loop: true, priority: 1, fadeDuration: 3f);
FF8.Audio.PlayBtnClick("assetName", callback);
FF8.Audio.PlayAudioEffect("assetName", callback);
FF8.Audio.VolumeAudioEffect = 0.5f;
FF8.Audio.SwitchAudioEffect = false;
FF8.Audio.SetUISoundComplete(callback);
FF8.Audio.SetBtnClickComplete(callback);
FF8.Audio.SetAudioEffectComplete(callback);
FF8.Audio.PlayAudioEffect2D("assetName", volume: 1f, maxNum: 5, callback);
FF8.Audio.PlayAudioEffect3D("assetName",
isRandom: true,
transform.position,
volume: 1f,
spatialBlend: 1f,
maxNum: 5,
callback);
FF8.Audio.PauseAll(); // Pause all, including one-shot AudioEffect instances
FF8.Audio.ResumeAll(); // Resume all, including one-shot AudioEffect instances
FF8.Audio.StopAll(); // Stop all, including one-shot AudioEffect instances
FF8.Audio.UnloadAll(true); // Unload all audio (true = force including in-use)
FF8.Audio.SetAudioMixer(FF8.Asset.Load<AudioMixer>("F8AudioMixer"));
FF8.Audio.AudioMusic.Pause();
FF8.Audio.AudioMusicVoice.Resume();
FF8.Audio.AudioMusicBtnClick.Stop();
FF8.Audio.AudioMusicUISound.UnloadAll();
spatialBlend: 1f and provide world position.| Error | Cause | Solution |
|---|---|---|
| Audio clip not found | Asset not in loadable directory | Ensure clip is under AssetBundles or Resources, press F8 |
| No sound on mobile | Volume or switch set to off | Check SwitchMusic/SwitchAudioEffect values |
| Memory leak from audio | Not unloading unused clips | Call UnloadAll() when transitioning scenes |
| One-shot SFX stops too early | Timer using scaled time or clip load failed | Use current AudioEffect implementation; it tracks one-shot instances with unscaled clip duration |
FF8.Asset.