Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
Now let's quickly go ahead in Crete
Script
Double h two
Have music playing in the scene
We can also use this to play ambient sounds or maybe even play a sound effect
When we complete the lab
And what do they do is create a new script
Secy sharp script
It's gonna be cold
Audio Trigger
Now go ahead open up this audio triggered by double-clicking on it
In what we're going to do is
In this case when I'm actually going to write a script from scratch
Right she's going to paste in
The Script that's below this video
No the reason I'm going to do Dad as opposed to writing the script from scratch
Is I had a feeling that you guys are
Ready to go ahead in start pasting in scripts as opposed to watching me write them from scratch
Subtitled by -♪ online-courses.club ♪- We compress knowledge for you! https://t.me/joinchat/ailxpXoW3JVjYzQ1
Otherwise these tutorials would be an hour 50 hours long so I know a lot of you
Probably most of you have a familiar understanding of code
No photos of you should don't
I need a little bit more practise I recommend looking at the Script below this video
I'm actually just
Writing update script from scratch
In typing up all of
The various lines of that Square
Just to get a better understanding of the code
And also practise writing
But for most of you I don't see a problem
With just
Pasting in that script
Over top
That was put there by The Fall
So
Go ahead and just paste in everything from The Script below
This video
And I'm not going to go over what this script
Says here just yet what I'm actually going to do is just save it
Energym back in the unity and use the Script just to get you
Understanding what this script actually does ok and we're going to go with this approach for a lot of future
And that is pasting in some scripts
So let's go ahead and just take a look
At
Creating a new game
Search create an empty gameobject
And we have to call this audio Trigger
Brunel
Now all I want to do is
For an audio trigger in Leeds to actually play sound right
So we're going to create a new audio source component onto this game up
And then we're going to drag the audio Trigger
Want a game object
In addition with added component that a box Collider 2D
Ok this is going to allow us to actually Trigger
Into
Disco boxer
Ok
Slight is Trigger here
And then also you want to make sure this layer is set to ignore raycast we don't want this to interact with the rake
Beanie Meadow
By the enemies
Alright
So now we have the audio Trigger
Prefab
That we can use make sure we set it as a prefab so just dragging over to a prefabs
So this is our audio trigger ok
Tesco Sienna audio Trigger
We have
A few controls here
That are written into our script
AutoPlay which play the sound in immediately regardless of being triggered
Controls title which we're not going to use this just yet we'll use this in front of videos
But it's basically will louder tidal to play
Example the title of a level the moment that the music starts playing
Fade speed is by default set to zero but we can set it to 10 in a really fast foods
A volume of 0 to a volume of 1 very quickly
Or we can have it such a 0 like it is now now the thing about being a 0
Is that 0 is going to basically ignore
Fade speed all together
What does that mean it means that any sound associated with audio trigger is going to play
Immediately
Ok
But for music and ambience we can have what does the fading slowly right as the scene
Leeds in
So that's why we're going to use food speed for only certain audio triggers
Luke is going to make the audio source loop is always going to do is just said that to true
But it's been controlled in her audio Trigger
Play Once is a little bit different than loop play Once means that if the player interacts with the
It's only going to occur once so this would be great
Maybe you walk
Towards the end of a level and you hit the final goal of the level
And you want to play some kind of
Maybe it's an audience clapping or some kind of celebratory song
You don't want to play over and over again if the play exits the trigger and then enters and exits in an entity
You not wanted to happen over and over again you only want it to happen once
But you can still loop so get example of this is
In Mario if
Exit
The level of finish the level
Uyt
The song to only be triggered once right but the song in loop
Are endlessly as long as the player has impressed a to continue to the next level
Well saddest sound Primary
In this allows us to just drag certain sound effects
So for example
Any of these sound effects here we just drag
Into this audio clip zone here
Hello finally Max volume Bush
Will primer set to 1
So that's how the audio trigger component looks in the inspector
What's my head in setup
In audio trigger for music which is called it Muse
Now this is an actually gonna be a trigger so we are really need the box Collider because this is just going to play bye
Play default
Just got head in drag a song
In this case when I use a song from a band called by forever
They've graciously given us
A few other songs to work with in the tutorials how to get want to use these songs in your actual
Game
You sure to reach out to Matt
At by forever in there
Link below with his email address they want to reach out in licence the songs
But if you want to use it for this tutorial
Westerleigh fine
Ok so we've got a sound here that's the song
What's the max volume to 1
Alexa scorpion tattoo AutoPlay too true
Base speed of
About 3 that's fine
We want to loop
We don't want to just play once we actually want to be able to
Let us play any time the player engage with the trigger
In this case there is no trigger but if there was a Trigger
The server trigger was
Something like maybe
This big here
You want the player to be able to enter in and out of it
And the song with always play right
Ok that looks great
And
What's go ahead
Tested out see if it works
Make sure we disable the box Collider here
Deploy
Alright
Good so I take a music and started to play
Nearest out next week I am just feels so much more live just with the simple song
Great
Alright guys so
It works well with music but when we just go ahead and copy that music
HS name in ambience
And the one with ambience as well
By default we have this Indians City sound effects was just dragged out in
And if you could play
You're here saddle City ambience in the background and not include
Sirens and
Soft ambient noise you might hear in a city
Barely hear the sirens
In Hawkinge
That sounds great
Alright
So that works great
Let's do one more thing with an audio Trigger
Let's go ahead and just dragon the audio Trigger
This was going to be called
Henderson
And all we got to do is just drag this over here
America
Eric Collider
And just scale it up
Like that
And let's just find a song or a sound effect that a play when the player complete
The level
What we can do as we can go to general sounds here
Here we can go to positive sounds and see what about this one
No I don't like that
That was chemical power up for
And I think a better word would be and sound
That sounds good
And just dragged that over
Set the max volume of 1
We're going to keep the feed speed at 0 because we don't want it to fade in we want to just play
The moment the user touches ok
Nh32 play Once
Ireland
Hey that's about it guys
Say that into protesting purposes what's disable this door
Just for now
So that I can run over and see if the sound actually plays
Alright sound place
So that's just a few examples of how you can use the audio trigger class
Subtitled by -♪ online-courses.club ♪- We compress knowledge for you! https://t.me/joinchat/ailxpXoW3JVjYzQ1
2
Had music add a means to your scene but also
Admiral areas that will play a sound when you enter those areas so this could be great for obviously ending a level
No secret zones
That the player might be able to find in the game
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.