Audio
Workflow
Audio is entirely managed by the ‘UI Manager Audio’ component, which is attached the Audio Manager game object in the demo scene. This component receives audio clips from ‘UI Manager’, manages overall volume via ‘Audio Mixer’, and plays audio clips through ‘Audio Source’. Assigned sliders will be used to configure specific volumes (e.g. SFX).
There are four types of audio mixer groups you can use. For example, you can set ‘SFX’ to the ‘Output’ field of any audio source component. If you want to use your own audio mixer, you can assign any of your mixers to the ‘Audio Mixer’ field. Make sure to create groups with the same name as in the image below and expose the parameters.
Scripting
using UnityEngine;
using Michsky.UI.Reach; // Reach UI namespace
public class SampleClass : MonoBehaviour
{
[SerializeField] private UIManagerAudio audioManager;
void Start()
{
// Set volume between 0.0001 and 1
audioManager.SetMasterVolume(0.5f);
audioManager.SetMusicVolume(0.5f);
audioManager.SetSFXVolume(0.5f);
audioManager.SetUIVolume(0.5f);
}
}
How can we help?
A premium WordPress theme with an integrated Knowledge Base,
providing 24/7 community-based support.