private void Update() { if (player.Grounded(false)) { targetVolume = refVolume * player.GetComponent <Rigidbody2D>().velocity.magnitude / 28; } else { targetVolume = 0f; } if (!player.enabled) { targetVolume = 0f; } skiAudio.volume = Mathf.Lerp(skiAudio.volume, targetVolume, 0.3f); }