I’m having all kinds of trouble with something that seems simple, so I think I’m missing something but for the life of me I can’t find what that is.
I have a simple bool, and I’d like to play an event when the bool is set to true. For context, this would be a looping boost/nitro sound for a car when the boost button is held down.
Here’s what I’ve tried:
-
Using SendMessage (“Play”) while true, and SendMessage (“Stop”) while false within a method in Update - this results in no audio or the event clicking and not playing (presumably because it’s trying to play/stop every frame)
-
Using SendMessage (“Play”) while true and removing SendMessage (“Stop”) will allow the sound to play, but it will only play after the button is released, not on press or while it’s being held. Obviously, it just repeats endlessly as well.
The event is a simple Timeline Sheet with a looping region + an Action Sheet with some instruments that play when triggered for a startup sound. It works fine in Studio.
I’ve also tried an alternate route where I just used a Continuous Parameter sheet between 0-1, and automated the volume based on the value (false = 0, true = 1). I did start that event on object start via the Studio Event Emitter component. That worked fine, which is even more confusing as it used the same bool, so I’m not sure why. I want to use the Timeline version so I can call the event when needed, but not have it continually playing in the background, even silently.
For additional context, in Unity I’m using the new input manager, and my button is set to Button, and I’m just checking whether it’s true or false in code. The boost works correctly on my rigidbody (applies a continuous force while pressed), so I’m assuming I’m missing something important regarding how to use Fmod.
Any help is much appreciated.