Unable to set parameter for one track inside unity, others work

Hello
I am currently working together with a composer to make music for a game im working on. He has composed 4 tracks, where 3 of them are working with parameters inside of unity. But one track doesnt update the parameter live inside unity. Although it works within FMOD studio when he changes parameters.

Have anyone had a similar bug? ie all tracks can change parameters inside fmod and unity except 1

Are all 3 tracks using the same parameter? If not, check if the parameter not working has the same setting “local/global” than the other ones.

Ah yes, all 3 tracks are using same parameter. How do i check for global or local? i used this code but it just returns ok:

print(CurrentLevelMusic.getParameterByName("action points", out actionPoints));

getParameter will only return an OK, the out will return the parameter.

Global parameters are read-only when accessed via an event. They must be accessed via the System parameter API in order to set their value.

https://www.fmod.com/resources/documentation-api?version=2.02&page=studio-api-system.html#studio_system_getparameterbyname

You can see if a parameter is local or global by accessing the parameter description via getParameterDescription and checking the parameter’s flags.

https://www.fmod.com/resources/documentation-api?version=2.02&page=studio-api-system.html#studio_system_getparameterdescriptionbyname

https://www.fmod.com/resources/documentation-api?version=2.02&page=studio-api-common.html#fmod_studio_parameter_flags

@richard_simms , is it also the case that we cannot read a global parameter value through the event instance (Studio::EventInstance::getParameterByID)?

I believe that’s the behavior I’m seeing, but I want to make sure that’s correct before I work around it.

Thanks,
Victor

No you can’t access it like this, if it’s global.
But if it works with your other events, what code do you use to access it? And finally, is your parameter global or local? I said to check that point, but it may not be the problem…

sorry i havent replied, have been busy with implementations. but yes thanks ill try it out. But i can set the other audio tracks by parameter in update, but there might be a bug with FMOD or the audio guy accidentally made one track global, ill check it out and get back to you!

void Start()
   {


    CurrentLevelMusic = FMODUnity.RuntimeManager.CreateInstance(PlayerStateEvent);

    CurrentLevelMusic.start();
}


// Update is called once per frame
void Update()
{


  CurrentLevelMusic.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject, GameObject.FindWithTag("Player").GetComponent<Rigidbody>()));
    CurrentLevelMusic.setParameterByName("action points", actionPoints);
    
    print(CurrentLevelMusic.getParameterByName("action points", out actionPoints));

}

so this is the code im using to set the parameter. The funny thing is, it works for 3 out of the 4 songs, but ill have to check if one is set to global.

btw is there a difference on local / global? on how parameters are set? sorry if its a dumb question,kinda new to this fmod stuff

No, the setting local/global is for the parameter only, it doesn’t concern the event which it’s used in. So the problem don’t seems to be this.

A global parameter shares its value to every event instances in the project calling it, the same value for all instances. A local parameter can have different values for each event instance.

Hmm ok that makes sense. So what you’re saying is that the global parameter will update all events that have a “reference” to it?

Hmm ill try to describe my setup atm.

So it’s an action game that will have different maps (scenes), and each map will have a separate track / background song that will play during the game. And each track have parameters that will change the track depending on what happens in the scene / game. So say you hit an enemy with an attack, then the song will change pace. And this is set up so, it will play certain sections for periods of time. Say first parameter 0 is the songs 0 to 20 second. and then when parameter 1 is set, it will play the next segment which is from 20-40 seconds.

And each map have their own event set up. So map 1 only plays track1, map 2 plays track2 etc.

And i can change parameter on each song / track except for one track haha. it’s really confusing because it works except for one.

Ah okay thanks.

So what im trying is this:

print(CurrentLevelMusic.getParameterByName("action points", out points));
print(points);

which correctly prints 1, but the song still doesnt change xD

i also consulted the artist about it and we debugged it with fmod, which was working, it just isnt working in unity , so yea. idk what it can be tbh

It’s a bit weird. Maybe rebuild FMOD banks, you may have an older version of the banks. The bug could also be in the fmod project your composer implemented. You should do a Live Update session to determine what API calls are passed from Unity to FMOD and how FMOD reacts to that.

ah yes i actually have two versions of the banks, ill try it out thanks!

hmm, how do i do a live update session?

You’ll find all the info here: https://fmod.com/resources/documentation-unity?version=2.01&page=user-guide.html#connecting-using-live-update
But you’ll need FMOD Studio installed and the FMOD project, which you don’t seem to have.

ah thx, yea i dont have those installed, ill ask the composer to help out

Ok so small update:
it works now!

This is embarrasing, but, there wasn’t any bugs, the track was simply just a bit longer haha, so i had to wait untill the parameter triggered. Anyways thanks for the help though and have a good one!

1 Like