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

**URL:** https://qa.fmod.com/t/unable-to-set-parameter-for-one-track-inside-unity-others-work/17621
**Category:** Unity
**Created:** [August 30, 2021, 10:23am UTC](https://qa.fmod.com/t/unable-to-set-parameter-for-one-track-inside-unity-others-work/17621 "2021-08-30T10:23:39Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![Angelo101](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@Angelo101](https://qa.fmod.com/u/Angelo101)
#### Post date: [August 30, 2021, 10:23am UTC](https://qa.fmod.com/t/unable-to-set-parameter-for-one-track-inside-unity-others-work/17621/1 "2021-08-30T10:23:39Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Alcibiade](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alcibiade/32/4284_2.png) [@Alcibiade](https://qa.fmod.com/u/Alcibiade)
#### Post date: [August 30, 2021, 1:27pm UTC](https://qa.fmod.com/t/unable-to-set-parameter-for-one-track-inside-unity-others-work/17621/2 "2021-08-30T13:27:26Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Angelo101](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@Angelo101](https://qa.fmod.com/u/Angelo101)
#### Post date: [August 30, 2021, 2:04pm UTC](https://qa.fmod.com/t/unable-to-set-parameter-for-one-track-inside-unity-others-work/17621/3 "2021-08-30T14:04:05Z")

</div>

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:

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

```

---

<div class="post-metadata">

### Author: ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)
#### Post date: [September 2, 2021, 1:06am UTC](https://qa.fmod.com/t/unable-to-set-parameter-for-one-track-inside-unity-others-work/17621/4 "2021-09-02T01:06:16Z")

</div>

`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](https://www.fmod.com/resources/documentation-api?version=2.02&page=studio-api-system.html#studio_system_setparameterbyid) in order to set their value.

[https://www.fmod.com/resources/documentation-api?version=2.02&page=studio-api-system.html#studio\_system\_getparameterbyname](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-system.html#studio_system_getparameterdescriptionbyname)

[https://www.fmod.com/resources/documentation-api?version=2.02&page=studio-api-common.html#fmod\_studio\_parameter\_flags](https://www.fmod.com/resources/documentation-api?version=2.02&page=studio-api-common.html#fmod_studio_parameter_flags)

---

<div class="post-metadata">

### Author: ![victor](https://avatars.discourse-cdn.com/v4/letter/v/3e96dc/32.png) [@victor](https://qa.fmod.com/u/victor)
#### Post date: [September 2, 2021, 4:33pm UTC](https://qa.fmod.com/t/unable-to-set-parameter-for-one-track-inside-unity-others-work/17621/5 "2021-09-02T16:33:17Z")

</div>

@richard_simms , is it also the case that we cannot read a global parameter value through the event instance ([Studio::EventInstance::getParameterByID](https://www.fmod.com/resources/documentation-api?version=2.02&page=studio-api-eventinstance.html#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

---

<div class="post-metadata">

### Author: ![Alcibiade](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alcibiade/32/4284_2.png) [@Alcibiade](https://qa.fmod.com/u/Alcibiade)
#### Post date: [September 2, 2021, 7:28pm UTC](https://qa.fmod.com/t/unable-to-set-parameter-for-one-track-inside-unity-others-work/17621/6 "2021-09-02T19:28:35Z")

</div>

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…

---

<div class="post-metadata">

### Author: ![Angelo101](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@Angelo101](https://qa.fmod.com/u/Angelo101)
#### Post date: [September 2, 2021, 7:56pm UTC](https://qa.fmod.com/t/unable-to-set-parameter-for-one-track-inside-unity-others-work/17621/7 "2021-09-02T19:56:58Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![Angelo101](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@Angelo101](https://qa.fmod.com/u/Angelo101)
#### Post date: [September 2, 2021, 8:00pm UTC](https://qa.fmod.com/t/unable-to-set-parameter-for-one-track-inside-unity-others-work/17621/8 "2021-09-02T20:00:43Z")

</div>

```
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

---

<div class="post-metadata">

### Author: ![Alcibiade](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alcibiade/32/4284_2.png) [@Alcibiade](https://qa.fmod.com/u/Alcibiade)
#### Post date: [September 2, 2021, 8:03pm UTC](https://qa.fmod.com/t/unable-to-set-parameter-for-one-track-inside-unity-others-work/17621/9 "2021-09-02T20:03:34Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Angelo101](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@Angelo101](https://qa.fmod.com/u/Angelo101)
#### Post date: [September 2, 2021, 8:16pm UTC](https://qa.fmod.com/t/unable-to-set-parameter-for-one-track-inside-unity-others-work/17621/11 "2021-09-02T20:16:04Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Angelo101](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@Angelo101](https://qa.fmod.com/u/Angelo101)
#### Post date: [September 2, 2021, 8:19pm UTC](https://qa.fmod.com/t/unable-to-set-parameter-for-one-track-inside-unity-others-work/17621/12 "2021-09-02T20:19:57Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Alcibiade](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alcibiade/32/4284_2.png) [@Alcibiade](https://qa.fmod.com/u/Alcibiade)
#### Post date: [September 2, 2021, 8:24pm UTC](https://qa.fmod.com/t/unable-to-set-parameter-for-one-track-inside-unity-others-work/17621/13 "2021-09-02T20:24:34Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Angelo101](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@Angelo101](https://qa.fmod.com/u/Angelo101)
#### Post date: [September 2, 2021, 8:26pm UTC](https://qa.fmod.com/t/unable-to-set-parameter-for-one-track-inside-unity-others-work/17621/14 "2021-09-02T20:26:21Z")

</div>

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

hmm, how do i do a live update session?

---

<div class="post-metadata">

### Author: ![Alcibiade](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alcibiade/32/4284_2.png) [@Alcibiade](https://qa.fmod.com/u/Alcibiade)
#### Post date: [September 2, 2021, 8:29pm UTC](https://qa.fmod.com/t/unable-to-set-parameter-for-one-track-inside-unity-others-work/17621/15 "2021-09-02T20:29:24Z")

</div>

You’ll find all the info here: [https://fmod.com/resources/documentation-unity?version=2.01&page=user-guide.html#connecting-using-live-update](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.

---

<div class="post-metadata">

### Author: ![Angelo101](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@Angelo101](https://qa.fmod.com/u/Angelo101)
#### Post date: [September 2, 2021, 8:31pm UTC](https://qa.fmod.com/t/unable-to-set-parameter-for-one-track-inside-unity-others-work/17621/16 "2021-09-02T20:31:40Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Angelo101](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@Angelo101](https://qa.fmod.com/u/Angelo101)
#### Post date: [September 2, 2021, 8:50pm UTC](https://qa.fmod.com/t/unable-to-set-parameter-for-one-track-inside-unity-others-work/17621/17 "2021-09-02T20:50:57Z")

</div>

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!
