Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Audio Audiosource.Playscheduled still runs when AudioLister is paused

Discussion in 'Audio & Video' started by JermalJoseph, Feb 25, 2021.

  1. JermalJoseph

    JermalJoseph

    Joined:
    Apr 9, 2018
    Posts:
    12
    I currently working on a game where the user will input their own tracks and listen to them while playing the game itself, instead of me looking for background music.The thing is i use audiosource.playscheduled to switch between songs.i hve two audio sources, one to play the song and the other will hve a audioclip loaded into it to play when the first one is done then the same thing repeats.I use AudioLister.pause to pause the audiosources,but the playscheduled still runs.So after unpausing the audiolister,the song just switches and plays the next song.Is there any other way to approach my music problem or even pause the audiosource.playscheduled ?
     
  2. Hikiko66

    Hikiko66

    Joined:
    May 5, 2013
    Posts:
    1,302
    Sounds like a bug. What version are you using?

    You should report the bug

    https://docs.unity3d.com/ScriptReference/AudioListener-pause.html
    In the meantime, you probably don't need your audio to be scheduled perfectly just for background music. You can just use play. PlayScheduled is more for syncing different audiosources with each other, and stitching audio segements together. You might have good reasons for using playscheduled instead, but you didn't list any.
     
    Last edited: Feb 26, 2021
  3. JermalJoseph

    JermalJoseph

    Joined:
    Apr 9, 2018
    Posts:
    12
    I m using Unity 2020.2.3f1,also I m mking my game for android.
     
  4. JermalJoseph

    JermalJoseph

    Joined:
    Apr 9, 2018
    Posts:
    12
    I dont really want it to be synced perfectly i just want it to play not instantly but after the first song is done.The thing is ,pausing audiolistener doesn't pause playschedule.I already found a solution but thks for your response.