I’m working on a 2D game where I’m trying to create audio by distance, so if the player is near, the audio will play louder on the speakers depending on the player/camera position. I attached a FMOD Studio Event Emitter to the object and checked Override Attenuation. However, it seems that it only works when the Min value is 1 and the Max value is 20. If I try to change to anything below 20 for Max Value, it won’t work at all.
When you ‘override’ the min/max values from Unity, it uses Studio::EventInstance::setProperty which will override the distance properties in the event’s macros drawer. When the ‘Distance Override’ is enabled, the settings in the override section are used for that specific spatializer effect instead.
I have created a task to improve the documentation for our Unity integration about this.
If you want everything in the event to be spatialized then you would put it on the Master Track, otherwise you can place it on the audio track if you only want specific sounds spatialized. If you only have one audio track or sound, then either way will behave the same.
But if I manually change the Min/Max value - either from the Spatializer or the macro - the sounds simply stop playing. I still don’t get why I can have different values for them.
The properties on the Spatializer are specified as ‘override’, and if you turn the override to on then the Min & Max in the macros gets greyed out, to allow for more customization/automation.
Is there anything in the logs when this occurs?
You may need to enable more logging by setting the logging level to 'Log".
I’m not sure if it is the way I’ve set up my event (I literally didn’t do anything complex), but I still don’t understand why enabling Override Atenuation in the FMOD Studio Event Emiiter component and playing around with the min/max values stops the sound. For example: currently the min value is set to 1 and the max is set to 20. If I change the max to let’s say 10, the sound stop playing (it is a looping sound). If I change to 15, it starts playing again (?).
All I want is to control the min/max distance (which I believe that’s what these numbers do control) the player must be in order to gradually stop the sound and still, it doesn’t make a sense to me why this is not working.
Am I missing something here?
There are a lot of things going on, but I can’t tell if there is something worth looking at. Mind giving me a hand on what should I look for?
Currently, it seems that the override for distance attenuation in FMOD is not working correctly in Unity.
If I set the range to 1–20 in FMOD and override it to 1–10 in Unity, attenuation doesn’t work. However, the sound turns off when the distance goes beyond 10 (e.g., at 11).
I suspect that FMOD might have implemented the override attenuation feature incorrectly.
Hey, thanks for the reply. Glad to know I’m not the only one having this problem. I even tried to create a brand new project in Unity and set up some sounds to test it, just to be sure that my project wasn’t being part of the problem (by messing around with something in the background or whatever). It didn’t work.
In the FMOD integration settings could you check the behavior setting (Unity Integration | Settings Behavior) which may be stopping the events if you move out side of their audible range?
Could I also please get a profiler session recording (FMOD Studio | Profiling) while the issue is happening. This will provide the API calls being made which may indicate what is happening. This can be uploaded to your profile.
Could I also see a code snippet setting the values?
I’ve never done this recording, so I’m sorry if I didn’t get it right. Also, I couldn’t upload anything on my profile because for some reason I had to register my project and I’m waiting for some kind of approval, so I can’t upload anything for now. Is there another way to upload it?
But here’s what I did:
I’ve enabled the Override option just like the first image in my first post. In Unity, I’ve enabled Override Attenuation with min value = 1 and max value = 10 (the max value can only be lowered to 15 as any value below that won’t play any sound). Just to remember that I’m working on a 2D game where some sounds should work like they are 3D.
Hope this helps.
Not sure if that’s what you’re asking for, I’m overriding the values through the FMOD Studio Event Emitter component.
EDIT:
I took a print from the profiler. Not sure if that can be of any help. Also, I don’t really know if I’m right, but it seems to me that there is something playing (the rain sound, which is the one I’m having problems with). However, no sound in Unity.
An option may be setting the attenuation object on the listener: Unity Integration | Game Components - Studio Listener. By default, the listener is attached to the MainCamera, however, you may not want the attenuation being applied to its position, so we can set the character as the attenuation object so spatialization is applied correctly.
and you can hear audio in the scene, then start the recording.
Live update is a powerful tool to use when developing with FMOD not just for recording profiler sessions! Please let me know if I can assist with live update/profiler futher.
For some reason, using the previous one wasn’t working the way I wanted (also, messing around with the min/max distance inside FMOD wasn’t changing anything in the spatializer. It only started to visually change when I selected the setting I just pointed out). Well, I guess that’s the best I can do for now. I’m marking your post as the solution.