# Attenuation Settings parameter problem in BeginPlay() (SpawnSoundAtLocation) C++

**URL:** <https://forums.unrealengine.com/t/attenuation-settings-parameter-problem-in-beginplay-spawnsoundatlocation-c/2153241>\
**Category:** Audio\
**Tags:** unreal-engine, question\
**Created:** [November 26, 2024, 8:58pm UTC](https://forums.unrealengine.com/t/attenuation-settings-parameter-problem-in-beginplay-spawnsoundatlocation-c/2153241 "2024-11-26T20:58:01Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [November 27, 2024, 6:07am UTC](https://forums.unrealengine.com/t/attenuation-settings-parameter-problem-in-beginplay-spawnsoundatlocation-c/2153241/4 "2024-11-27T06:07:49Z")

</div>

I think I have found an alternative solution:

This works in BeguinPlay()

```auto

	Audio = UGameplayStatics::SpawnSoundAtLocation
	(
		World,
		Sound, 
		Location,
		Rotation, 
		Volume, 
		PitchMultiplier, 
		StartTime, 
		nullptr,           
		nullptr,           
		false              
	);

```

Then apply the attenuation when I need to play.

```auto
Audio->AdjustAttenuation(AttenuationSettings->Attenuation);
Audio->Play();

```

* * *

But I have not been able to verify if it really works because `"au.Debug.SoloAudio"` is not working either.

> [@I need help to fix an audio problem (UserWidget)](https://forums.unrealengine.com/t/i-need-help-to-fix-an-audio-problem-userwidget/1762544/2):
>
> Can you try to set “AllowBackgroundAudio” to true in the editor settings? It is disabled by default - and I think that is why you are not hearing any sound (because the second PIE window has no user focus and thus is in the background) [image] Let me know if this fixes it +1

* * *

Ok I think it works (finally)…

I Hate The Software Development Life Cycle… Especially when instead of fixing things they break them.

* * *

---

_[View the full topic](https://forums.unrealengine.com/t/attenuation-settings-parameter-problem-in-beginplay-spawnsoundatlocation-c/2153241)._
