I have a project set up where the music will change depending on whether the player is currently drawing attention from enemies. I have this set up using two magnet regions, one for the normal music and one for the alert music, using a 0-1 float parameter to change between the two - 0 being normal and 1 being alert. The music initially plays as normal, but when the alert is triggered, it will switch to the alert music but also keep playing the normal music at the same time. Any ideas or easy fixes?
It sounds like you’re using an asynchronous instrument for your normal music, but haven’t set it to stop playing when untriggered.
Assuming that’s the case, the easiest solution is to select the normal music instrument and click the “Cut” button in the deck. This toggles on cut mode, meaning that the instrument will cut out immediately when untriggered.
Of course, it’s possible that cutting out immediately might sound too abrupt. If that’s the case, you can instead make the normal music instrument fade out when untriggered by selecting the instrument, right-clicking on its volume property in the deck, and selecting “Add Modulation > AHDSR.” This adds an AHDSR modulator to the instrument, ensuring that it fades in when triggered and fades out when untriggered; you can customise how quickly it fades in and out by changing its “Attack” and “Release” properties, respectively.
I don’t have asynchronous enabled on either of the instruments, so I’m a bit confused and not sure if this is the issue. I have attached a screenshot
of my project
In that case, I’m afraid I don’t understand how the BOR_L2_calm instrument can continue playing when the playback position has moved to the Region A region. It is the defining feature of synchronous instruments that they play the part of the waveform that’s underneath the timeline playback position, so it should be impossible for the instrument to continue playing once the playback position has moved off it.
I must be missing some important detail of how your event works. Does the issue still occur if you set the BOR_L2_action instrument’s volume to -oo dB? What about if you leave the BOR_L2_action instrument’s volume as it is, but set the BOR_L2_calm insturment’s volume to -oo dB?
Sorry, I think I missed the context that within FMOD Studio, this setup works perfectly fine, but when the action theme is triggered within Unity, the magnet regions play simultaneously. Basically the calm theme is never stopped when the combat parameter is set to 1
Interesting… That suggests that your Unity project actually starting two instances of the event, and only updating the parameter value of one of them.
You can test this by connecting to your game using live update, recording a session in FMOD Studio’s profiler window, and looking at the lifespans view or Instances view.
Assuming that you are playing multiple instances of the same event, you’ll have to investigate your Unity project to see where it is creating instances of this event, and stop it from doing so.