Audio Spatialization breaks when adding additional scripting

Hi there,

I’m a composer and very new to C# scripting.

I am using FMOD Studio as a middleware in this project. I’m fairly sure this is more of an issue with the script I have written though, hence I wanted to ask for assistance on this forum…

I have ambiences playing around the character, and I’m wanting to have FX on these ambiences turn on and off depending on whether the player is moving or not. The script I have written initiates my FMOD event and will also dictate whether my custom parameter within FMOD is turned on (based on if the player pressing the arrow keys).

Here is my script:


FMOD.Studio.EventInstance MainEvent;

void Start()


        MainEvent = FMODUnity.RuntimeManager.CreateInstance("event:/MainEvent");



void Update()


    if (Input.GetAxis("Horizontal") == 1f || Input.GetAxis("Horizontal") == -1f)


        Debug.Log("Set Param");

        MainEvent.setParameterByName("MoveFX", 1f);



            MainEvent.setParameterByName("MoveFX", 0f);




The event starts fine and the parameter works in the way I want it to, but a weird thing I’m finding is the spatialisation orientation becomes incorrect.

Instead of the audio being perceptively in front of the player with a wide stereo spread, the audio is panned hard left and is flipped 90 degrees…making the audio sound like it is mono.

I get this warning from Unity:

[FMOD] Instance of Event event:/MainEvent has not had EventInstance.set3DAttributes() called on it yet! UnityEngine.Debug:LogWarningFormat(String, Object[]) FMODUnity.RuntimeManager:Update() (at Assets/Plugins/FMOD/src/Runtime/RuntimeManager.cs:433)

so it has something to do with setting 3D attributes in order for the spatialisation to be correct…

Any help would be greatly appreciated!


  • Tom

As you said, you need to set the 3D attributes.

You can do this one of two ways – attaching MainEvent to a game object with
FMODUnity.RuntimeManager.AttachInstanceToGameObject(MainEvent, someTransform, someRigidbody);

replacing someTransform and someRigidbody accordingly. This will automatically update the event position if the object moves.

Or you can set 3D attributes manually:

MainEvent.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(someTransform, someRigidbody));

keep in mind that your event emitter will be fixed in place until you call set3DAttributes again.

Both of these approaches are covered in the basic scripting examples page, which is a really helpful learning resource. I still refer to it regularly!

This won’t necessarily solve your stereo spread issue though – You might want to play with the “Envelopment” controls of the Spatializer component in FMOD Studio. Increasing the "spread’ and “sound size” might get you closer to the behavior you want; by default the spatializer tends toward hard panning.

Hey mate

Thanks very much for your quick response!

This worked a charm and now my spatialisation is all corrected.

Thank you very much!

No problem! I’m here a lot trying to solve my own problems; it’s nice to help out others when I can.