Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:06,656 --> 00:00:12,800
Now let's quickly go ahead in Crete
2
00:00:13,056 --> 00:00:13,568
Script
3
00:00:13,824 --> 00:00:15,360
Double h two
4
00:00:15,872 --> 00:00:17,920
Have music playing in the scene
5
00:00:18,432 --> 00:00:24,576
We can also use this to play ambient sounds or maybe even play a sound effect
6
00:00:24,832 --> 00:00:25,856
When we complete the lab
7
00:00:26,624 --> 00:00:28,672
And what do they do is create a new script
8
00:00:29,184 --> 00:00:30,208
Secy sharp script
9
00:00:30,976 --> 00:00:31,744
It's gonna be cold
10
00:00:32,256 --> 00:00:33,536
Audio Trigger
11
00:00:36,352 --> 00:00:39,168
Now go ahead open up this audio triggered by double-clicking on it
12
00:00:39,936 --> 00:00:41,216
In what we're going to do is
13
00:00:41,728 --> 00:00:45,056
In this case when I'm actually going to write a script from scratch
14
00:00:45,312 --> 00:00:46,848
Right she's going to paste in
15
00:00:47,104 --> 00:00:49,664
The Script that's below this video
16
00:00:50,176 --> 00:00:54,016
No the reason I'm going to do Dad as opposed to writing the script from scratch
17
00:00:54,272 --> 00:00:56,832
Is I had a feeling that you guys are
18
00:00:57,088 --> 00:01:01,677
Ready to go ahead in start pasting in scripts as opposed to watching me write them from scratch
19
00:01:01,679 --> 00:01:04,028
Subtitled by
-♪ online-courses.club ♪-
We compress knowledge for you!
https://t.me/joinchat/ailxpXoW3JVjYzQ1
20
00:01:04,028 --> 00:01:09,632
Otherwise these tutorials would be an hour 50 hours long so I know a lot of you
21
00:01:09,888 --> 00:01:13,472
Probably most of you have a familiar understanding of code
22
00:01:13,728 --> 00:01:15,264
No photos of you should don't
23
00:01:15,520 --> 00:01:19,872
I need a little bit more practise I recommend looking at the Script below this video
24
00:01:20,128 --> 00:01:21,152
I'm actually just
25
00:01:21,664 --> 00:01:24,224
Writing update script from scratch
26
00:01:24,480 --> 00:01:26,016
In typing up all of
27
00:01:26,272 --> 00:01:27,808
The various lines of that Square
28
00:01:28,064 --> 00:01:30,112
Just to get a better understanding of the code
29
00:01:30,624 --> 00:01:32,416
And also practise writing
30
00:01:32,672 --> 00:01:34,720
But for most of you I don't see a problem
31
00:01:34,976 --> 00:01:35,744
With just
32
00:01:36,768 --> 00:01:38,048
Pasting in that script
33
00:01:38,560 --> 00:01:39,584
Over top
34
00:01:39,840 --> 00:01:41,632
That was put there by The Fall
35
00:01:42,400 --> 00:01:42,912
So
36
00:01:43,424 --> 00:01:46,496
Go ahead and just paste in everything from The Script below
37
00:01:46,752 --> 00:01:47,520
This video
38
00:01:47,776 --> 00:01:50,592
And I'm not going to go over what this script
39
00:01:50,848 --> 00:01:54,432
Says here just yet what I'm actually going to do is just save it
40
00:01:54,688 --> 00:01:58,272
Energym back in the unity and use the Script just to get you
41
00:01:58,528 --> 00:02:04,672
Understanding what this script actually does ok and we're going to go with this approach for a lot of future
42
00:02:04,928 --> 00:02:07,744
And that is pasting in some scripts
43
00:02:09,280 --> 00:02:11,840
So let's go ahead and just take a look
44
00:02:12,608 --> 00:02:13,376
At
45
00:02:13,632 --> 00:02:15,168
Creating a new game
46
00:02:15,936 --> 00:02:17,472
Search create an empty gameobject
47
00:02:18,752 --> 00:02:21,312
And we have to call this audio Trigger
48
00:02:21,568 --> 00:02:22,080
Brunel
49
00:02:24,128 --> 00:02:25,408
Now all I want to do is
50
00:02:25,664 --> 00:02:28,992
For an audio trigger in Leeds to actually play sound right
51
00:02:29,248 --> 00:02:32,576
So we're going to create a new audio source component onto this game up
52
00:02:35,136 --> 00:02:37,440
And then we're going to drag the audio Trigger
53
00:02:38,464 --> 00:02:39,744
Want a game object
54
00:02:40,512 --> 00:02:44,352
In addition with added component that a box Collider 2D
55
00:02:44,864 --> 00:02:47,936
Ok this is going to allow us to actually Trigger
56
00:02:48,448 --> 00:02:49,216
Into
57
00:02:50,752 --> 00:02:51,776
Disco boxer
58
00:02:52,032 --> 00:02:52,544
Ok
59
00:02:54,080 --> 00:02:55,360
Slight is Trigger here
60
00:02:56,896 --> 00:03:03,040
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
61
00:03:03,296 --> 00:03:04,320
Beanie Meadow
62
00:03:04,576 --> 00:03:05,600
By the enemies
63
00:03:07,392 --> 00:03:07,904
Alright
64
00:03:08,416 --> 00:03:10,976
So now we have the audio Trigger
65
00:03:11,232 --> 00:03:12,000
Prefab
66
00:03:12,768 --> 00:03:16,608
That we can use make sure we set it as a prefab so just dragging over to a prefabs
67
00:03:17,376 --> 00:03:19,680
So this is our audio trigger ok
68
00:03:19,936 --> 00:03:21,984
Tesco Sienna audio Trigger
69
00:03:22,752 --> 00:03:23,520
We have
70
00:03:23,776 --> 00:03:25,568
A few controls here
71
00:03:25,824 --> 00:03:28,128
That are written into our script
72
00:03:28,384 --> 00:03:32,736
AutoPlay which play the sound in immediately regardless of being triggered
73
00:03:33,248 --> 00:03:37,856
Controls title which we're not going to use this just yet we'll use this in front of videos
74
00:03:38,112 --> 00:03:41,440
But it's basically will louder tidal to play
75
00:03:41,952 --> 00:03:46,560
Example the title of a level the moment that the music starts playing
76
00:03:47,072 --> 00:03:53,216
Fade speed is by default set to zero but we can set it to 10 in a really fast foods
77
00:03:54,240 --> 00:03:58,080
A volume of 0 to a volume of 1 very quickly
78
00:03:58,592 --> 00:04:03,968
Or we can have it such a 0 like it is now now the thing about being a 0
79
00:04:04,224 --> 00:04:07,808
Is that 0 is going to basically ignore
80
00:04:08,064 --> 00:04:09,600
Fade speed all together
81
00:04:09,856 --> 00:04:14,720
What does that mean it means that any sound associated with audio trigger is going to play
82
00:04:14,976 --> 00:04:15,744
Immediately
83
00:04:16,000 --> 00:04:16,512
Ok
84
00:04:17,024 --> 00:04:23,167
But for music and ambience we can have what does the fading slowly right as the scene
85
00:04:23,423 --> 00:04:23,935
Leeds in
86
00:04:24,447 --> 00:04:28,799
So that's why we're going to use food speed for only certain audio triggers
87
00:04:29,311 --> 00:04:33,919
Luke is going to make the audio source loop is always going to do is just said that to true
88
00:04:34,431 --> 00:04:36,479
But it's been controlled in her audio Trigger
89
00:04:36,991 --> 00:04:43,135
Play Once is a little bit different than loop play Once means that if the player interacts with the
90
00:04:43,903 --> 00:04:47,487
It's only going to occur once so this would be great
91
00:04:47,999 --> 00:04:49,023
Maybe you walk
92
00:04:49,279 --> 00:04:53,631
Towards the end of a level and you hit the final goal of the level
93
00:04:53,887 --> 00:04:55,423
And you want to play some kind of
94
00:04:55,935 --> 00:05:00,799
Maybe it's an audience clapping or some kind of celebratory song
95
00:05:01,055 --> 00:05:07,199
You don't want to play over and over again if the play exits the trigger and then enters and exits in an entity
96
00:05:07,455 --> 00:05:10,783
You not wanted to happen over and over again you only want it to happen once
97
00:05:11,295 --> 00:05:14,879
But you can still loop so get example of this is
98
00:05:15,391 --> 00:05:16,671
In Mario if
99
00:05:16,927 --> 00:05:17,439
Exit
100
00:05:17,695 --> 00:05:19,231
The level of finish the level
101
00:05:19,487 --> 00:05:20,511
Uyt
102
00:05:20,767 --> 00:05:25,119
The song to only be triggered once right but the song in loop
103
00:05:25,375 --> 00:05:29,983
Are endlessly as long as the player has impressed a to continue to the next level
104
00:05:32,031 --> 00:05:33,823
Well saddest sound Primary
105
00:05:34,591 --> 00:05:37,151
In this allows us to just drag certain sound effects
106
00:05:37,407 --> 00:05:38,175
So for example
107
00:05:38,943 --> 00:05:40,991
Any of these sound effects here we just drag
108
00:05:41,247 --> 00:05:43,039
Into this audio clip zone here
109
00:05:43,551 --> 00:05:45,599
Hello finally Max volume Bush
110
00:05:45,855 --> 00:05:47,391
Will primer set to 1
111
00:05:49,183 --> 00:05:53,023
So that's how the audio trigger component looks in the inspector
112
00:05:53,535 --> 00:05:55,071
What's my head in setup
113
00:05:55,839 --> 00:05:59,167
In audio trigger for music which is called it Muse
114
00:05:59,935 --> 00:06:06,079
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
115
00:06:06,335 --> 00:06:06,847
Play default
116
00:06:07,359 --> 00:06:09,663
Just got head in drag a song
117
00:06:10,687 --> 00:06:14,271
In this case when I use a song from a band called by forever
118
00:06:14,527 --> 00:06:16,319
They've graciously given us
119
00:06:16,575 --> 00:06:22,719
A few other songs to work with in the tutorials how to get want to use these songs in your actual
120
00:06:22,975 --> 00:06:23,487
Game
121
00:06:23,743 --> 00:06:25,791
You sure to reach out to Matt
122
00:06:26,047 --> 00:06:27,583
At by forever in there
123
00:06:27,839 --> 00:06:32,447
Link below with his email address they want to reach out in licence the songs
124
00:06:32,959 --> 00:06:35,007
But if you want to use it for this tutorial
125
00:06:35,263 --> 00:06:36,287
Westerleigh fine
126
00:06:37,055 --> 00:06:40,127
Ok so we've got a sound here that's the song
127
00:06:40,639 --> 00:06:42,175
What's the max volume to 1
128
00:06:42,687 --> 00:06:45,503
Alexa scorpion tattoo AutoPlay too true
129
00:06:46,271 --> 00:06:47,551
Base speed of
130
00:06:47,807 --> 00:06:49,343
About 3 that's fine
131
00:06:49,599 --> 00:06:50,879
We want to loop
132
00:06:51,135 --> 00:06:54,207
We don't want to just play once we actually want to be able to
133
00:06:54,463 --> 00:06:57,791
Let us play any time the player engage with the trigger
134
00:06:58,047 --> 00:07:00,863
In this case there is no trigger but if there was a Trigger
135
00:07:02,911 --> 00:07:04,447
The server trigger was
136
00:07:04,703 --> 00:07:05,727
Something like maybe
137
00:07:06,495 --> 00:07:07,519
This big here
138
00:07:08,031 --> 00:07:10,335
You want the player to be able to enter in and out of it
139
00:07:10,591 --> 00:07:12,895
And the song with always play right
140
00:07:13,663 --> 00:07:15,455
Ok that looks great
141
00:07:17,759 --> 00:07:19,039
And
142
00:07:19,807 --> 00:07:20,575
What's go ahead
143
00:07:20,831 --> 00:07:22,367
Tested out see if it works
144
00:07:22,879 --> 00:07:25,183
Make sure we disable the box Collider here
145
00:07:25,951 --> 00:07:26,719
Deploy
146
00:07:29,791 --> 00:07:30,303
Alright
147
00:07:30,559 --> 00:07:34,143
Good so I take a music and started to play
148
00:07:41,823 --> 00:07:47,967
Nearest out next week I am just feels so much more live just with the simple song
149
00:07:48,223 --> 00:07:51,039
Great
150
00:07:52,319 --> 00:07:53,855
Alright guys so
151
00:07:54,111 --> 00:07:57,951
It works well with music but when we just go ahead and copy that music
152
00:07:58,463 --> 00:08:00,255
HS name in ambience
153
00:08:00,511 --> 00:08:02,047
And the one with ambience as well
154
00:08:03,071 --> 00:08:07,679
By default we have this Indians City sound effects was just dragged out in
155
00:08:08,959 --> 00:08:10,239
And if you could play
156
00:08:10,495 --> 00:08:14,079
You're here saddle City ambience in the background and not include
157
00:08:14,335 --> 00:08:16,127
Sirens and
158
00:08:18,431 --> 00:08:21,247
Soft ambient noise you might hear in a city
159
00:08:22,527 --> 00:08:23,807
Barely hear the sirens
160
00:08:25,599 --> 00:08:26,367
In Hawkinge
161
00:08:26,879 --> 00:08:27,903
That sounds great
162
00:08:28,671 --> 00:08:29,183
Alright
163
00:08:30,719 --> 00:08:31,743
So that works great
164
00:08:32,255 --> 00:08:34,815
Let's do one more thing with an audio Trigger
165
00:08:35,327 --> 00:08:37,887
Let's go ahead and just dragon the audio Trigger
166
00:08:38,655 --> 00:08:39,935
This was going to be called
167
00:08:43,263 --> 00:08:44,287
Henderson
168
00:08:45,311 --> 00:08:47,871
And all we got to do is just drag this over here
169
00:08:50,687 --> 00:08:51,199
America
170
00:08:52,223 --> 00:08:53,247
Eric Collider
171
00:08:54,015 --> 00:08:55,039
And just scale it up
172
00:08:55,551 --> 00:08:56,319
Like that
173
00:08:57,855 --> 00:09:03,231
And let's just find a song or a sound effect that a play when the player complete
174
00:09:03,487 --> 00:09:04,255
The level
175
00:09:04,511 --> 00:09:07,327
What we can do as we can go to general sounds here
176
00:09:07,583 --> 00:09:11,935
Here we can go to positive sounds and see what about this one
177
00:09:15,775 --> 00:09:17,055
No I don't like that
178
00:09:19,871 --> 00:09:21,663
That was chemical power up for
179
00:09:22,431 --> 00:09:25,247
And I think a better word would be and sound
180
00:09:25,503 --> 00:09:26,271
That sounds good
181
00:09:26,783 --> 00:09:28,575
And just dragged that over
182
00:09:28,831 --> 00:09:30,367
Set the max volume of 1
183
00:09:30,623 --> 00:09:35,999
We're going to keep the feed speed at 0 because we don't want it to fade in we want to just play
184
00:09:36,255 --> 00:09:38,559
The moment the user touches ok
185
00:09:39,327 --> 00:09:41,119
Nh32 play Once
186
00:09:42,911 --> 00:09:43,935
Ireland
187
00:09:45,215 --> 00:09:46,495
Hey that's about it guys
188
00:09:46,751 --> 00:09:50,335
Say that into protesting purposes what's disable this door
189
00:09:51,103 --> 00:09:51,871
Just for now
190
00:09:52,383 --> 00:09:55,455
So that I can run over and see if the sound actually plays
191
00:09:57,759 --> 00:09:59,039
Alright sound place
192
00:09:59,551 --> 00:10:02,636
So that's just a few examples of how you can use the audio trigger class
193
00:10:02,637 --> 00:10:04,434
Subtitled by
-♪ online-courses.club ♪-
We compress knowledge for you!
https://t.me/joinchat/ailxpXoW3JVjYzQ1
194
00:10:05,183 --> 00:10:05,951
2
195
00:10:06,207 --> 00:10:09,279
Had music add a means to your scene but also
196
00:10:09,791 --> 00:10:15,679
Admiral areas that will play a sound when you enter those areas so this could be great for obviously ending a level
197
00:10:15,935 --> 00:10:17,727
No secret zones
198
00:10:17,983 --> 00:10:24,127
That the player might be able to find in the game
14841
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.