Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I pause sounds and music? #29

Open
MadScientist11 opened this issue Dec 29, 2023 · 1 comment
Open

How do I pause sounds and music? #29

MadScientist11 opened this issue Dec 29, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@MadScientist11
Copy link

Hi! I want to be able pause and resume music. I just started using JSAM and I didn't see how to do this in docs, so I wanted to ask what's the better way to do it properly. Since method StopAllMusic calls Stop and not Pause, right now, the only idea I have is to access all audio sources and call AudioSource.Pause, but surely there should be a better way to do it? What I want at the end is to pause all sounds, except UI.

@jackyyang09
Copy link
Owner

There is currently no helper API to pause all audio in one go, I'll be adding that in the next update.

In the meantime, besides accessing all AudioSources, one workaround is to use JSAM's time scaling feature. In the case that you are pausing all audio for the implementation of a "Pause" menu, changing the Time.timeScale value also affects the pitch of audio objects with time-scaling enabled, so setting Time.timeScale to 0 will pause all audio. In case this doesn't work, make sure Time Scaled Sounds is enabled in the JSAM Project Settings.

Hope this helps

@jackyyang09 jackyyang09 added the enhancement New feature or request label Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants