# Parameter changes successfully but not transition to right region

**URL:** <https://qa.fmod.com/t/parameter-changes-successfully-but-not-transition-to-right-region/19992>\
**Category:** Unity\
**Tags:** unity\
**Created:** [March 20, 2023, 8:21am UTC](https://qa.fmod.com/t/parameter-changes-successfully-but-not-transition-to-right-region/19992 "2023-03-20T08:21:04Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![shishui](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@shishui](https://qa.fmod.com/u/shishui)\
**Post date:** [March 20, 2023, 8:21am UTC](https://qa.fmod.com/t/parameter-changes-successfully-but-not-transition-to-right-region/19992/1 "2023-03-20T08:21:04Z")

</div>

hi!here’s my script

```auto
        public static BGM_Manager instance;
        private EventInstance AudioInstance_Chat;
        private void Awake()
        {
            instance = this;
            DontDestroyOnLoad(gameObject);

            AudioInstance_Chat = RuntimeManager.CreateInstance("event:/BGM/M_ChatBGM");
        }
        
        public void Chat_ChangeEvent(string GoalPerson)
        {
            Debug.Log("Chat Change To " + GoalPerson);
            AudioInstance_Chat.start();
            AudioInstance_Chat.setParameterByNameWithLabel("NowChatPerson", GoalPerson);

            float a ;
            AudioInstance_Chat.getParameterByName("NowChatPerson", out a);
            Debug.Log(a);
            AudioInstance_Chat.start();
        }

```

I set origin parameter as “0”.And when I play Unity,the parameter will be changed to “1”. And music can be changed to “region1\_Music”,which is what I want.  
But when I set parameter as “2”,I can only hear “region0\_Music”,not “region2\_Music”

the result shows that parameter has been changed to “2”,but I can only hear music which is “region0\_Music”.

here’s my fmod’s screenshot

 ![Snipaste_2023-03-20_16-19-05](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/3/389dc928e65b1b20c6205ca902bc64ebf43fb173.png)

And in Fmod Engine,music can transition to right region.

Thank you!

ps:I find that when the music goes to wrong region,it will print"exinfo-\>initialseekposition = 144548" in Unity console,and when music goes to right region,it won’t print this.

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [March 22, 2023, 1:38am UTC](https://qa.fmod.com/t/parameter-changes-successfully-but-not-transition-to-right-region/19992/2 "2023-03-22T01:38:13Z")

</div>

> [@shishui](#):
>
> I set origin parameter as “0”.And when I play Unity,the parameter will be changed to “1”. And music can be changed to “region1\_Music”,which is what I want.  
> But when I set parameter as “2”,I can only hear “region0\_Music”,not “region2\_Music”

Hi!

Correct me if I’m wrong, but it appears to me that based on your sceenshot that you don’t have a transition from “region0” to “region2”. This means that you wouldn’t transition away from “region0” if you changed the parameter from 0 straight to 2 - you’d need to change it to 1 first. If you add the appropriate transition regions to “region0”, your code should work fine.

---

<div class="post-metadata">

**Author:** ![shishui](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@shishui](https://qa.fmod.com/u/shishui)\
**Post date:** [March 22, 2023, 10:10am UTC](https://qa.fmod.com/t/parameter-changes-successfully-but-not-transition-to-right-region/19992/3 "2023-03-22T10:10:54Z")

</div>

Hi!Thank you! It’s a good solution.  
So even if “region1” is playing,when I change the parameter to “region 2”,it will check for transitions from “region 0” instead of “region 1”, right?  
Because when unity starts playing, I have set the parameter to region1 and can hear the region1 music playing.I don’t know if this counts as “change it to 1 first”.

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [March 23, 2023, 12:53am UTC](https://qa.fmod.com/t/parameter-changes-successfully-but-not-transition-to-right-region/19992/4 "2023-03-23T00:53:07Z")

</div>

> [@shishui](#):
>
> So even if “region1” is playing,when I change the parameter to “region 2”,it will check for transitions from “region 0” instead of “region 1”, right?  
> Because when unity starts playing, I have set the parameter to region1 and can hear the region1 music playing.I don’t know if this counts as “change it to 1 first”.

Transitions markers/regions are only checked when the playhead has reached/is on them. If, in the screenshot you’ve linked, region 1 is playing, then the transition regions that you’ve placed in region 1 are checked against - none of the other ones are.

If you can hear region 1 music, then you should be in region 1. If you’re in region 1, but for some reason cannot transition to region 2 with the setup in your screenshot, then it might be that the transition conditions on your “To region2” transition in region 1 are set up incorrectly, or that you have added the correct transition but haven’t rebuilt your banks since doing so.

If everything is set up correctly and you’re still getting the issue, could I get your Unity, FMOD Studio, and FMOD Unity version numbers?

---

<div class="post-metadata">

**Author:** ![shishui](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@shishui](https://qa.fmod.com/u/shishui)\
**Post date:** [March 23, 2023, 3:24am UTC](https://qa.fmod.com/t/parameter-changes-successfully-but-not-transition-to-right-region/19992/5 "2023-03-23T03:24:04Z")

</div>

I confirm that "To region 2"transition in region1 are set up correctly.I just rebuild banks,but this problem still exists.  
And I find that if I add transition “To region2” to region0 and delete this transition in region1, when parameter is set to “region1” and then to “region2”,I can hear region1 music and then region2 music, meaning it can transition to region2.(like this screenshot)  
 ![Snipaste_2023-03-23_11-08-26](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/1/1c3038b97abe60d9c45aa0de46771c18745e2397.png)  
It seems like when I call “setParameterByNameWithLabel”, it will jump to beginning of the timeline which is in region1.

Here are version numbers.  
Unity version:2020.3.19f1  
Fmod Studio version:2.02.11  
Fmod Unity version:2.02.03

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [March 23, 2023, 5:04am UTC](https://qa.fmod.com/t/parameter-changes-successfully-but-not-transition-to-right-region/19992/6 "2023-03-23T05:04:54Z")

</div>

Unfortunately I haven’t been able to replicate the behavior where region 2 can be transitioned to from region 1 using the setup in your most recent screenshot. If you’re able to, can you update the FMOD Unity plugin to match your Studio version (2.02.11), and see whether the issue persists? If not, or if it does persist, would it be possible to get you to upload your FMOD Studio project (or a stripped down version of it containing the event in question) so that I can take a look at it and hopefully diagnose the issue? You can do so at [https://www.fmod.com/profile](https://www.fmod.com/profile) in the “Uploads” section.

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [March 24, 2023, 4:28am UTC](https://qa.fmod.com/t/parameter-changes-successfully-but-not-transition-to-right-region/19992/7 "2023-03-24T04:28:18Z")

</div>

After having taken another look at your code, this issue is likely being caused because you’re calling `AudioInstance_Chat.start()` again when setting the parameter. Calling `start()` places the playhead at the start of the timeline, at which point it evaluates the transition regions there, and not at whatever region it was in before you called `start()`. Removing the `start()` calls from your code in `Chat_ChangeEvent()` should fix the issue.

---

<div class="post-metadata">

**Author:** ![shishui](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@shishui](https://qa.fmod.com/u/shishui)\
**Post date:** [March 24, 2023, 5:24am UTC](https://qa.fmod.com/t/parameter-changes-successfully-but-not-transition-to-right-region/19992/8 "2023-03-24T05:24:55Z")

</div>

Thank you for your reply. I was waiting for my project to be approved so I could upload my Fmod Studio project. Now the problem is completely solved!
