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");
}
MainEvent.start();
}
void Update()
{
if (Input.GetAxis("Horizontal") == 1f || Input.GetAxis("Horizontal") == -1f)
{
Debug.Log("Set Param");
MainEvent.setParameterByName("MoveFX", 1f);
}
else
{
{
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!
Cheers,
- Tom