Pause Music on List Method! / QUESTION / SCRIPT

Hi folks i have a question i would like to share with you:

with your help I´ve been able to create an script to play some slave GameObjects with fmod emitter inside into a master GameObject which contains all the slaves inside…

this is what i mean:

the idea is that everytime the scene with the script inside load, an event from the list you see in the image is going to play, so far is working but im having problems adding the pause method in this script:

in the internet ive see multiple methods to do it but for my specific idea no method is working!!

could u solve this riddle? i just want to been able to pause the music when the pause button is pressed…

an idea from youtube says that we could use snapshots and a parameter to trigger sometype of filter, if that could work, how i could been able to call the snapshot in the script i just share with you guys??? or the parameter trigger could go inside the pause button gameObject in Unity to trigger the parameter???

HOPE U GUYS UNDERSTAND MY IDEA AND MY GRAMMAR, def english is not my primary languageD:

Hi,

You could use the EventInstance::setPaused function (FMOD Engine | Studio API Reference - Event Instance).

  1. With the trackToPlay int we know which event we need to pause so we will use that to choose the emitter in our list
  2. With the emitter in our list we can retrieve the EventInstance with tracks[trackToPlay].EventInstance (Unity Integration | Scripting API Reference - StudioEventEmitter)
  3. Now with the EventInstance you can call setPaused()

I would suggest creating two public functions in your class PauseCurrentTrack() and ResumeCurrentTrack(). With these two functions, you can pause a start the current track in the list.

Hope this helps!

bro i love you for answer but i dont know script :frowning: i already try everything to make your reply work but my abilities are not that good, if you could explain a little more further or put the code lines based on my image in the post here i would aprecciate so much :frowning:

sorry for my grammar english is not my first language hope i explained well

1 Like

so far i gat this

i dont know how to reference the list in the methods D:

1 Like

Hi,

Please find attached a script that has two public functions PuaseCurrentTrack() and ResumeCurrentTrack(). Hopefully, this is the functionality you are looking for.
PlayMusic.txt (933 Bytes)

dudeeeeeee thank you so much man I know is not your work do mine but this really help me out; the doc you send does not work entirely but it sure give me the answer i need; with the FMOD. Result i was able to reference my list in the methods then in the general script of the game i call the instance from the script who has the methods with the FMOD.Results inside.

THANK YOU VERY MUCH CONNOR I LOVE YOU!!!

1 Like

Hi,

Happy to help!