- Home /
Add audio.
Two questions, and please explain well. First, how can I play an audio clip five seconds after the game starts?
Second, how can I play an audio clip when the player passes certain places in the level.
ALSO, THIS IS A 2D PLATFORMER.
Answer by MaxGuernseyIII · Sep 30, 2017 at 06:56 AM
This is two questions.
The answer to the first is create a Coroutine that returns new WaitForSeconds(5) then calls Play on the audio source.
There are various answers to the second. Probably something elegant to do with colliders and/or triggers or something. You can also just put a script on the player that watches for when the player enters a certain zone by checking the player's position and then plays an audio source and disables or destroys itself.
Unless what you are looking for is to have a sound that seems like it is coming from a certain part of the game - like it gets louder when you get closer and quieter when you get further away. Something like a waterfall or whatever. That has to do with how you configure your audio source.
Your answer
Follow this Question
Related Questions
How to Find gameObject child. 3 Answers
What happened to Line Renderer! 1 Answer
Flip Player, but don't flip the Player's Child. 2 Answers
Flip Player, Not the Player's Child. 3 Answers
How can I find gameObject child. 0 Answers