How to Pause/Resume a dialogue (audio) with player's movement?
I am working on a 2d game, where the player moves left/right through pressing buttons. There is a dialogue(audio file) playing in the background. What I am trying to achieve is- - If the player stops moving/walking- the audio dialogue(AUDIO A) should pause and a new audio (AUDIO B) to play for that period, when player is not moving. - once the player starts moving- another audio (AUDIO C) should play once and then AUDIO A can be resumed.
sorry i am just a beginner and have no idea on how to get this thing done. I would really appreciate any help on this.
Thanks
Answer by ibobtouch · Feb 27, 2019 at 05:10 PM
If you look at the documentation for the AudioSource component, there is a "time" properties that gives you the playback time of the current audio's playing. You could store this in a variable when the player stops moving, do whatever you want, then when you want to resume, simple set the time to your variable value.
Your answer
Follow this Question
Related Questions
I'm trying to do multiple AudioSources, but one won't play...... 0 Answers
Detecting when two different audio sources are emitting sound in Unity 0 Answers
Playing numerous audio files in a row when spawning? 2 Answers
How to Send Audio Clip Via Facebook Messenger ? 0 Answers
Pick Up Sound 0 Answers