UnityNinja Community
Would you like to react to this message? Create an account in a few clicks or log in to continue.

UnityNinja CommunityLog in

UnityNinja - Video Game Development Community, including Resources, Forums, Marketplace & More.


descriptionHow do i add music? EmptyHow do i add music?

more_horiz
Hey guys, I was wondering if anyone knows how to have music playing in the background of a game and if they are any way to have it play at a certain time. Help is much appreciated.

descriptionHow do i add music? EmptyRe: How do i add music?

more_horiz
Set up an audio source on the object itself (can be any GO) with your audio listener. Have that source handle all the music for the game, and it should have a constant volume in all speakers. You can also set up an audio source somewhere in the world with a rolloff factor of 0. You'll run into it shifting from speaker to speaker depending on where it is relative to you, though. In terms of a certain time, can you be more specific? I can help you with that.

descriptionHow do i add music? EmptyRe: How do i add music?

more_horiz
What i mean by certain time is making music play during an event or when the player does an action or enter an area like the music in slender gets increasingly louder and dramatic as you progress and the drum sound effect occurs when you see him.

descriptionHow do i add music? EmptyRe: How do i add music?

more_horiz
Kunoru wrote:
What i mean by certain time is making music play during an event or when the player does an action or enter an area like the music in slender gets increasingly louder and dramatic as you progress and the drum sound effect occurs when you see him.
Use triggers with the audio source..
something like "OnTriggerStay () { AudioSource.Play(); } OnTriggerExit () { AudioSource.Stop(); }"

descriptionHow do i add music? EmptyRe: How do i add music?

more_horiz
Thanks for the help. ^_^

descriptionHow do i add music? EmptyRe: How do i add music?

more_horiz
Kunoru wrote:
Thanks for the help. ^_^
Sure thing Smile

descriptionHow do i add music? EmptyRe: How do i add music?

more_horiz
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply