public static BGM_Manager instance;
private EventInstance AudioInstance_Chat;
private void Awake()
instance = this;
AudioInstance_Chat = RuntimeManager.CreateInstance("event:/BGM/M_ChatBGM");
public void Chat_ChangeEvent(string GoalPerson)
Debug.Log("Chat Change To " + GoalPerson);
float a ;
AudioInstance_Chat.getParameterByName("NowChatPerson", out a);
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”.
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.
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”.
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?
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)
It seems like when I call “setParameterByNameWithLabel”, it will jump to beginning of the timeline which is in region1.
Here are version numbers.
Fmod Studio version:2.02.11
Fmod Unity version:2.02.03
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 in the “Uploads” section.
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.