Get parameter value inside unity


(Gautam Vishwanath) #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.


(Cameron Baron) #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#/


(Gautam Vishwanath) #3

Thank you, it worked out very well :slight_smile: