- Home /
what is the best way to make game overworld music?
I'm trying to make an open world game but I'm having a hard time trying to define my town boarders. I had tried a technique of attaching music to a game object like the cube or sphere and put an audio listener attached to a 3rd person camera, which is attached to my character(unity chan). I wanted the music to activate upon her physical body entering the object with music attached
--my problem so far is all my music plays at once despite my character being outside any of the boundaries.
is it because Unity chan has physics? should I make my world procedural and break it into like a bunch of separate rooms/scenes? (I'm still pretty new to coding)
what is the best or easiest way to attach music to a game world/scene?
Answer by JoltenDev · Feb 24, 2020 at 06:48 AM
If you wanted a music track to play when a character enters through a cube or any object, you can give that object a collider (if I doesn't already have one) and set isTrigger to on, that will make it so that you can walk through that object and it will detect when the player has walked through the object. Then when you've done that, attach a script to the object and use the OnTriggerEnter parameter to start the music when a player has collided with the object, you'll also might wanna set the music active to false on start or you can attach the audio source to the camera, set a reference, and then disable it in the camera and activate on trigger. :) hope this helped!
Your answer
Follow this Question
Related Questions
module music preview 0 Answers
How does AudioSource.pitch changes pitch? 1 Answer
Flowing Music 2 Answers
If statement not working. 3 Answers
Menu Music Issue!! 2 Answers