Troubleshooting Common Issues

"Sound doesn't play"

  • Check if Audio Manager is in the scene

  • Verify the sound exists in Audio Library

  • Check volume settings (global, category, individual)

  • Ensure audio clip is assigned to the sound asset

"Too many audio sources error"

  • Increase Initial Pool Size in Audio Manager inspector

  • Or use USM.StopAllSFX() to clear existing sounds

  • Implement sound priority in your game logic

"Audio cutting out"

  • Sounds are being stopped prematurely

  • Check if objects are being destroyed before sound finishes

  • Use USM.IsPlaying(audioID) to check sound status

  • Consider using longer fade outs

Scene Persistence

Making Audio Manager Persistent:

// The Audio Manager automatically persists between scenes
// if you don't destroy it manually

// To make it persist explicitly:
DontDestroyOnLoad(USM.Instance.gameObject);

Scene Transition Example:

public class SceneLoader : MonoBehaviour
{
    public void LoadNextScene()
    {
        // Music continues playing through scene changes
        // Sound effects will be stopped unless persisted
        SceneManager.LoadScene("NextScene");
    }
    
    public void LoadSceneWithMusicChange()
    {
        // Crossfade to new music for new scene
        USM.CrossfadeMusic((Audio.Music.BackGroundMusic), 2.0f);
        SceneManager.LoadScene("NextScene");
    }
}

Advanced Configuration

Custom Initialization:

public class CustomAudioSetup : MonoBehaviour
{
    void Start()
    {
        // Wait for Audio Manager to initialize
        StartCoroutine(SetupAudio());
    }
    
    IEnumerator SetupAudio()
    {
        yield return new WaitUntil(() => USM.Instance != null);
        
        // Custom audio setup
        USM.SetGlobalVolume(0.9f);
        USM.AutoDuckEnable(0.6f, 0.3f, 0.8f);
        USM.PlayMusic("AmbientMusic");
    }
}

Runtime Configuration:

// Change pool size at runtime (not recommended during gameplay)
// This requires careful management and should be done during loading

// Better to set appropriate pool size during initialization
// and use sound prioritization in your game design

Last updated