Комментарии:
7 years later and still incredibly insightful. Thank you, this is helping a lot.
ОтветитьThanks for this. Found it just in time for a project I was working on. While I had to tweak it for my application, the practical example showed me exactly what I needed.
ОтветитьThank you very much british man!!!!
ОтветитьVery Smart way to do it
Ответитьthe music is not switching please help
ОтветитьLovely when one thing stops you from making it work. I'm getting the "the type or namespace is missing 'Audio Manager'". In the SwitchAudioTrigger script.
ОтветитьBro u did everything i need, thank you!
Ответитьdoes anyone know how to change the music track back to the original
ОтветитьThank you so much! I was able to implement this to changing my BG music to a Boss Music
ОтветитьMUITO FODA AJUDOU MUITO
MUITO OBRIGADO AJODOU MUITO
VC É FODA AJODIU SUITO
4 everyone doin similar code and still havin problems ... try tag Player as Player ;)
Ответитьthank you very much this really help me
Ответитьif i want the music changing blendedly, i cant use this
ОтветитьThank you very much!!! Its Amazing!
ОтветитьIncredibly helpful and easy to understand. Thanks for putting this together!
Ответитьthank you!
ОтветитьLove it..Thanks
ОтветитьHmm I don't know about this, I would probably prefer to have every music track be represented by a bool in the music manager. Then you could just reference the music manager and activate/deactivate bools to start playing the music you want. Then you'll have all the music tracks listed neatly in the manager. Then a function to be called from the music manager to fade in or fade out music.
bool snowyVillage;
audioClip snowyVillage;
GameObject BGMObject;
audioSource BGM;
void Awake()
{
BGMObject = GameObject.FindWithTag("Music");
BGM = mainMenuMusic.GetComponent<AudioSource>();
}
void Update()
{
if(snowyVillage){
BGM.clip = snowyVillage;
}
}
void fadeIn()
{
BGM.volume -= 0.28f * Time.deltaTime;
}
More or less something like this?
Very helpful! Thank you!
Ответитьto khely guy kho mokhry
ОтветитьI have a problem:
I made the exact same thing as you did, but it doesn't work. If I want to make "private AudioManager theAM;" Unity doesn't know the word "AudioManager" so I can't do anything.
The only difference is that I have other variable names and in the menu script (the script for changing the scene) the functions for changing and 1 function so the screen fades in. I only want the music to change when I press the "Credits" button, but when I press the other 2 buttons the music should continue.
I have the newest Unity Engine (2017.3.1)
Please help me
How do I make it so the audio does not play in a specific scene? I've been struggling for a while.
ОтветитьThank you I am implementing your logic in my upcoming game! Great work, clean code.
Ответитьits like switching music but the other music is in the other scene
Ответитьcan you tell me how to pause sound that is from the other scene when i play sound..?
i want to get the audio source of the sound that goes throughtout the game and pause it to make other sound play and resume afetr
Jpe yp fp yjod yp foggrtrmy dvrmd
Ответитьwhat can i do if I'm using the unity engine UI I'm not a programmer but I'm trying to do the switch track when you push a 2d button?
Ответитьhi James, do u know something about android audio latency? I discovered that if I for example put a Ui button on scene then play audio pressing this button, so on pc everything works good, but on Android I hear sound after maybe 0.1 second still I press it, don't u know how to solve this problem not using other plugins? thanks for that!
and sorry if my English is not perfect
One question. Are you using Unity 5.3 because ontriggerenter2d does not work in newest version
ОтветитьThanks for the video! this will be useful
Ответить