FMOD Unity Integration Problem (Ver 1.09.06)

Hello,

I just changed to the new integration package between FMOD and Unity (1.09.06) and everything seems to work except for the SetParameter method… It appears as if it just completely ignores the line of code that calls for a parameter change. I was wondering if anybody knows how to fix this. I’m using FMOD ver. 1.09.06 and UnityIntegrationPackage 1.09.06v2, with Unity ver 5.04.0f3. This is my code:

FMODUnity.StudioEventEmitter emitter;

void Start () 
{
	var target = GameObject.Find ("Player");
	emitter = target.GetComponent<FMODUnity.StudioEventEmitter> ();

}

void Update () {
	emitter.SetParameter ("mxChange", 0.6F);
}

}

I had it the exact same way before (using FMOD and integration package ver 1.08.14v2 and same version of Unity) and it worked perfectly fine. Please help!! Thank you!

SetParameter should return a FMOD.RESULT, if it isn’t “OK” then there may be another issue. Are you getting any warnings or errors?

Nope none at all… it’s like if it didn’t even realized the line exists. I even changed the parameter name in the SetParameter to something random to see if it gave me an error but it just seems to ignore that line!

Ah sorry, it’s not SetParameter that returns a result but the function that it calls, setParameterValue. This will only get called if the eventInstance inside the emitter is not null.

That being said, if you try to set the parameter value on an emitter before it has started playing, the instance will be null and the parameter will not be set.

I see, the problem is it has started playing. I can hear the event play, but not change the parameter. Weirdest thing is it works perfectly on ver. 1.08.20 and before :(. Any other ideas?

I can’t see a reason why it wouldn’t work, try using the following code, it basically does the same thing but instead of using a FMODEventEmitter script it just creates an event and sets the parameter value. If this works then there may be an issue with the emitter:

[FMODUnity.EventRef]    public string eventName;
FMOD.Studio.EventInstance eventInstance;

void Start ()
{
    var target = GameObject.Find("Player");
    eventInstance = FMODUnity.RuntimeManager.CreateInstance(eventName);
    eventInstance.start();
    FMODUnity.RuntimeManager.AttachInstanceToGameObject(eventInstance, target.transform, GetComponent<Rigidbody>());
}

void Update ()
{
    FMOD.RESULT result = eventInstance.setParameterValue("intensiTy", 1.0f);
    Debug.Log(result);
}

This works! I think I can find a workaround for what I was trying to do with this code. However, is there an explanation why my emitters are not working in this new version? It would still be easier for me to solve this issue first as there are too many events changing parameters and I’d have to change the code in all of them! Thank you so much for this tho!

I can’t reproduce the issue, emitters are still working fine here. It could be an issue caused by the upgrade between 1.08 and 1.09. You could try deleting the Assets/Plugins/FMOD folder and re-importing it.