Get parameter value inside unity

#1

Hi,

I’m new to fmod but fairly experienced in Unity. A simple question, but getting my head around it all the time.

I have a StudioEventEmitter called ‘boatSoundController’ and a parameter called ‘boat_movement’. I need to constantly receive values of ‘boat_movement’ so that I can pass it on to other floats in Unity.
Is there a way I can see the parameter value during runtime? I can see the initial parameter value in the event, but not it’s constantly updated value!

Any help would be much appreciated. Thanks.

0 Likes

#2

You would have to do this in your own script.

You will want to get the EventInstance from the StudioEventEmitter.

Or you can create and control an Event from your own script, where you would also have direct access to the Instance.
Here is an example of how you can use FMOD in a script:
https://fmod.com/resources/documentation-api?page=content/generated/engine_new_unity/script_example_basic.html#/

Once you have the EventInstance you can call EventInstance::getParameterValue whenever you need the current value.
https://fmod.com/resources/documentation-api?page=content/generated/FMOD_Studio_EventInstance_GetParameterValue.html#/

0 Likes

#3

Thank you, it worked out very well :slight_smile:

0 Likes

#4

This feels very complicated. I’m trying to simply tween a volume and digging into this things feels like a waste of time. Why not simply have access to a GetParameter method?

0 Likes

#5

You can access the EventInstance of a StudioEventEmitter and call getParameter() directly on that.
We just haven’t had any requests for that sort of helper function previously.

0 Likes