Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
//Part of the script
/// <summary>
/// Loop for lowering the volume
/// </summary>
private IEnumerator UpdateRoutine()
{
while (true)
{
UpdateVolume();
yield return new WaitForSeconds(_targetTime);
}
}
/// <summary>
/// Lower the volume
/// </summary>
private void UpdateVolume()
{
AudioListener.volume = Mathf.Clamp01(AudioListener.volume + _currentDelta);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment