Sound in a certain area

How do I make a sound so that I can hear it only in a certain area, not using Sound Attenuation, but for example, as in a box, when I enter it, the sound is heard and when I leave it is not heard?

Hey there @popadens! This entirely depends on how you’re intending to manage your audio, the environment, if you still want directionality, and if the audio is meant to be transient. For this example, I’ll be using a an Audio component in a single player environment.

Basically this will only play when the player is inside the box collision. This does have edge cases, where if the player teleports into or outside of the collision it may not register. Same for deaths/spawning, etc.

This may not fit use case, as it technically just turns it off. If you need it to remain active/running you could instead use a similar setup to mute it but let it play. If the only requirement is “sound can be heard in box and not outside of box” this fits the bill. 2D sounds can also be used if you don’t want any directionality.

1 Like

Is it possible to make the sound disappear smoothly when leaving the box?

Yes, in stead of stop use Fade out function which is also in audio just like stop function. There is also a Fade in function there.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.