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
So what the heck are we looking at
2
00:00:13,056 --> 00:00:18,176
I know it's confusing it's really not that confusing so basically what happened was
3
00:00:18,688 --> 00:00:19,456
Unity
4
00:00:19,712 --> 00:00:21,504
Put together a template for us
5
00:00:21,760 --> 00:00:26,368
This is basically a c-sharp template this is how all of your script to go to start
6
00:00:26,880 --> 00:00:27,904
When you create the
7
00:00:28,928 --> 00:00:29,696
First
8
00:00:30,208 --> 00:00:35,328
Appear when I get a worry too much about what's going on but these are just called namespaces
9
00:00:35,584 --> 00:00:39,168
Honestly were just gonna scroll down I just ignore it for now
10
00:00:39,680 --> 00:00:41,216
So this is really
11
00:00:41,472 --> 00:00:42,752
The meat of our Sky
12
00:00:43,520 --> 00:00:45,568
Basically what happening is
13
00:00:45,824 --> 00:00:46,592
You're saying
14
00:00:47,104 --> 00:00:48,896
There is a class or
15
00:00:49,152 --> 00:00:51,456
Another way of thinking of it is there is a script
16
00:00:51,712 --> 00:00:54,784
Dad public in will talk about what public and private mean
17
00:00:55,040 --> 00:00:56,576
That's called player
18
00:00:58,112 --> 00:01:00,653
This calling means it extends to the monobehaviour
19
00:01:00,655 --> 00:01:03,131
Subtitled by
-♪ online-courses.club ♪-
We compress knowledge for you!
https://t.me/joinchat/ailxpXoW3JVjYzQ1
20
00:01:03,132 --> 00:01:03,488
The manor behaviour is basically
21
00:01:03,744 --> 00:01:04,768
In layman's terms
22
00:01:05,280 --> 00:01:07,840
The foundation or the root level
23
00:01:08,096 --> 00:01:08,608
Of
24
00:01:08,864 --> 00:01:12,704
What makes a unity script in unity c-sharp script
25
00:01:12,960 --> 00:01:17,056
There's certain properties that we can use because we're extending
26
00:01:17,312 --> 00:01:18,592
To the Manor behaviour
27
00:01:18,848 --> 00:01:20,384
When I got way too much about it
28
00:01:20,896 --> 00:01:27,040
I know that already that sounds confusing why is this a colon why is that green what's a monobehaviour
29
00:01:27,296 --> 00:01:28,576
Why is the class blue
30
00:01:28,832 --> 00:01:34,976
Used to all these Colours as you continue writing scripts and don't get too bogged
31
00:01:35,232 --> 00:01:37,024
Down in the minute details right now
32
00:01:37,536 --> 00:01:42,656
All you need to know is that unity created a script for us and that's script through this
33
00:01:42,912 --> 00:01:44,704
Template in front of us
34
00:01:45,216 --> 00:01:47,264
In that template basically said
35
00:01:47,520 --> 00:01:48,800
Hey this is a script
36
00:01:49,056 --> 00:01:50,080
Call Claire
37
00:01:50,848 --> 00:01:53,152
And it is a monobehaviour
38
00:01:54,176 --> 00:01:55,712
Can you tell me TVs curly brackets
39
00:01:55,968 --> 00:01:59,040
Does an opening and closing bracket as well
40
00:01:59,552 --> 00:02:01,344
The dad of lime here to show
41
00:02:01,600 --> 00:02:07,744
Hey all of this is one set here and what is that set well it's the public class play
42
00:02:08,512 --> 00:02:12,096
So this curly bracket is immediately going to start telling unity
43
00:02:12,608 --> 00:02:14,912
Hey all of this continent here
44
00:02:15,168 --> 00:02:17,728
Is part of the public class player
45
00:02:17,984 --> 00:02:22,080
You let mine and make perfect sense but just bear with me when she keep going
46
00:02:22,336 --> 00:02:28,480
Before we talk about what voidstar does in void update us explained
47
00:02:28,736 --> 00:02:31,040
How unity read The Script
48
00:02:31,552 --> 00:02:32,832
Pic of universe
49
00:02:33,088 --> 00:02:34,368
Being here really
50
00:02:34,624 --> 00:02:36,160
Fast speed reader
51
00:02:37,184 --> 00:02:42,816
Is going to read using system start collections then is going to jump to using systems that collections that generic
52
00:02:43,072 --> 00:02:45,888
He's going to move down to using unity engine
53
00:02:46,400 --> 00:02:48,192
And then he's going to hit this
54
00:02:48,448 --> 00:02:49,728
He was going to say ok
55
00:02:49,984 --> 00:02:51,520
The something called a player
56
00:02:51,776 --> 00:02:54,336
M&S going to hit this
57
00:02:54,848 --> 00:02:55,872
Which is the star
58
00:02:56,640 --> 00:03:02,784
In basically what this function does in unity this function through pretty much every c-sharp script you write
59
00:03:03,296 --> 00:03:06,624
The very beginning working at tell unity
60
00:03:06,880 --> 00:03:09,696
To do something the moment we hit the start button
61
00:03:10,208 --> 00:03:11,744
Tell us about a quick script here
62
00:03:12,000 --> 00:03:15,840
Don't get too in the weeds here just follow along as best you can
63
00:03:16,352 --> 00:03:17,120
Debug
64
00:03:17,888 --> 00:03:18,656
That log
65
00:03:21,216 --> 00:03:21,728
Hello
66
00:03:23,776 --> 00:03:28,128
And you'll see a red squiggly there that means we need to close out this
67
00:03:28,384 --> 00:03:29,152
Sentence
68
00:03:29,408 --> 00:03:29,920
Or
69
00:03:30,176 --> 00:03:30,944
Statement
70
00:03:31,200 --> 00:03:32,480
With a semicolon
71
00:03:35,296 --> 00:03:36,832
I would say about the Script
72
00:03:37,344 --> 00:03:38,880
And you're back in the universe
73
00:03:40,928 --> 00:03:41,952
Wait for it to compile
74
00:03:43,232 --> 00:03:47,072
Everything was good will have any errors being thrown in the console that's good
75
00:03:48,352 --> 00:03:50,400
Now I want to do before we hit play
76
00:03:50,656 --> 00:03:54,752
Is it gonna make sure we drag this script onto a game on
77
00:03:55,008 --> 00:03:56,032
Search create
78
00:03:58,080 --> 00:03:58,848
3D object
79
00:03:59,616 --> 00:04:00,896
What's a ECU
80
00:04:02,432 --> 00:04:04,480
Let's put it as 000
81
00:04:06,016 --> 00:04:09,088
How to make sure camera is also a 0 position
82
00:04:10,368 --> 00:04:12,160
-10 z-axis is good
83
00:04:12,416 --> 00:04:15,232
You must be sure to rename rq player
84
00:04:16,768 --> 00:04:17,791
I'm going to drag x
85
00:04:21,375 --> 00:04:23,423
And as you can see the player script
86
00:04:24,191 --> 00:04:27,775
Is on the inspector tab so now it's a component
87
00:04:28,031 --> 00:04:30,847
I've player so we have the mesh filter of the mesh renderer
88
00:04:31,359 --> 00:04:34,431
The box Collider and also the player script we just create
89
00:04:35,711 --> 00:04:36,735
Square head in hip play
90
00:04:37,759 --> 00:04:39,807
As you can see in the console window
91
00:04:40,319 --> 00:04:41,087
We have
92
00:04:41,343 --> 00:04:47,231
Printed the word hello in print is just a fancy word of saying display or right
93
00:04:50,047 --> 00:04:51,327
So that's what this
94
00:04:52,351 --> 00:04:55,167
Wirral line Deirdre debug.log
95
00:04:55,423 --> 00:04:55,935
Hello
96
00:04:56,447 --> 00:05:00,287
By the way too much have the same tax year just know that that was the point
97
00:05:00,799 --> 00:05:02,591
Of this function start
98
00:05:03,615 --> 00:05:07,199
Unity will read this and go ok I need to do something
99
00:05:07,455 --> 00:05:09,759
When we start the unity player
100
00:05:10,783 --> 00:05:15,647
Any me later read this and say you know what I'm gonna print hello in the console
101
00:05:16,927 --> 00:05:20,255
Unity is never going to fire this function again ever
102
00:05:20,767 --> 00:05:22,303
He's never going to do this again
103
00:05:22,559 --> 00:05:25,375
It only happens when I seen loads
104
00:05:25,631 --> 00:05:27,167
So that's the benefit of start
105
00:05:27,423 --> 00:05:29,471
Wigan position the player here
106
00:05:29,727 --> 00:05:31,519
We can spawn DayZ object
107
00:05:31,775 --> 00:05:33,567
We can set the health to zero
108
00:05:34,079 --> 00:05:37,919
We do all sorts of cool things the moment the game begins
109
00:05:39,455 --> 00:05:42,015
Now the update function is pretty much
110
00:05:42,271 --> 00:05:44,063
The opposite of what started is
111
00:05:44,831 --> 00:05:49,183
Update says do this over and over and over again
112
00:05:49,439 --> 00:05:50,975
60 frames per sec
113
00:05:51,743 --> 00:05:54,559
Again ticket unity as a really fast speed reader
114
00:05:54,815 --> 00:05:58,143
Once unity gets passed the start function
115
00:05:58,655 --> 00:06:00,191
He continues to read down
116
00:06:00,703 --> 00:06:01,471
He says
117
00:06:01,983 --> 00:06:03,263
Here is an update function
118
00:06:03,775 --> 00:06:05,567
I'm going to read this
119
00:06:05,823 --> 00:06:06,335
Forever
120
00:06:06,591 --> 00:06:09,919
And ever and ever at 60 frames per second
121
00:06:10,175 --> 00:06:11,711
So he's going to read down it
122
00:06:12,479 --> 00:06:13,503
Any backup
123
00:06:14,015 --> 00:06:17,343
Again and again and again and again
124
00:06:18,111 --> 00:06:20,671
The question is why on earth would we want to do that
125
00:06:20,927 --> 00:06:25,279
Any engineers well that's how we actually have stuff happening in a game
126
00:06:25,535 --> 00:06:29,119
To resemble we can move the position of the player
127
00:06:29,631 --> 00:06:30,911
Every iteration
128
00:06:31,167 --> 00:06:36,031
Search write a script to better understand what the update function is actually do
129
00:06:37,055 --> 00:06:41,919
First begin to write a little comment here the way you comment in a script is
130
00:06:42,175 --> 00:06:43,199
Two slashes
131
00:06:44,991 --> 00:06:45,759
Move
132
00:06:46,015 --> 00:06:47,807
Me to the right
133
00:06:48,319 --> 00:06:49,599
One you
134
00:06:51,647 --> 00:06:57,791
So there's a comment so now let's try and write a script that achieves that comment obviously
135
00:06:58,047 --> 00:06:59,583
How to read a comment for every screen
136
00:06:59,839 --> 00:07:02,911
But comments help you better understand what you're writing
137
00:07:03,423 --> 00:07:06,751
To the way we do this is something like transform
138
00:07:08,543 --> 00:07:09,311
That position
139
00:07:10,847 --> 00:07:11,615
Equals
140
00:07:12,383 --> 00:07:14,175
New vector3
141
00:07:14,431 --> 00:07:14,943
1
142
00:07:15,199 --> 00:07:15,967
0
143
00:07:16,223 --> 00:07:16,735
Zara
144
00:07:17,759 --> 00:07:18,783
And just remember
145
00:07:19,295 --> 00:07:21,855
You want to end every statement with a semicolon
146
00:07:24,159 --> 00:07:24,927
Theresa Lee
147
00:07:25,183 --> 00:07:27,231
We cannot access the transformer components
148
00:07:27,743 --> 00:07:28,767
My inspector
149
00:07:29,023 --> 00:07:34,399
And we can access the position portion of that transform so that's transformed at position
150
00:07:34,655 --> 00:07:35,935
And we're going to set it to
151
00:07:36,959 --> 00:07:40,543
A vector3 in what a vector3 is basically a position
152
00:07:40,799 --> 00:07:42,079
Acts of 1
153
00:07:43,359 --> 00:07:45,407
Why is 0nz a 0
154
00:07:45,663 --> 00:07:47,967
We had save jump back in the universe
155
00:07:49,759 --> 00:07:50,527
The notice
156
00:07:50,783 --> 00:07:54,111
We'll have any errors as go ahead in clear the console
157
00:07:54,879 --> 00:07:56,671
That's it play and see what happens
158
00:07:57,183 --> 00:08:03,327
Noticed that his position is now set to 1 so did exactly what we wanted it to whatever you wanted to have it
159
00:08:03,583 --> 00:08:04,863
Move to the right
160
00:08:05,375 --> 00:08:08,447
Over and over and over again currently
161
00:08:08,959 --> 00:08:10,751
It's just been set to 1
162
00:08:11,263 --> 00:08:15,615
It's not actually moving what the way we achieve this is when we move it
163
00:08:15,871 --> 00:08:21,247
Over 1 unit relative to its previous position to the way we will do that is
164
00:08:21,503 --> 00:08:22,527
Transform
165
00:08:23,295 --> 00:08:26,111
That position x + 1
166
00:08:28,159 --> 00:08:30,975
Search try and understand what this line actually means
167
00:08:32,511 --> 00:08:34,303
Basically I want my position
168
00:08:34,559 --> 00:08:35,583
2 equal
169
00:08:36,095 --> 00:08:38,143
My current x position
170
00:08:38,911 --> 00:08:39,935
Plus 1
171
00:08:40,703 --> 00:08:41,983
What save this song
172
00:08:43,519 --> 00:08:44,799
And see what happens
173
00:08:47,871 --> 00:08:48,639
There goes
174
00:08:49,151 --> 00:08:50,943
Zoom out really far here
175
00:08:51,199 --> 00:08:52,991
Guess he's moving pretty fast
176
00:08:53,759 --> 00:08:56,319
Now why is he continually doing
177
00:08:57,599 --> 00:09:02,719
Well the reason why is if you jump into the Script what currently happening is
178
00:09:02,975 --> 00:09:04,767
Unity is reading this line
179
00:09:05,023 --> 00:09:05,791
Over
180
00:09:06,047 --> 00:09:07,071
Andover
181
00:09:07,327 --> 00:09:08,351
In over again
182
00:09:08,607 --> 00:09:13,727
Why is he not reading this line well that's because he knows that the start function only happens once
183
00:09:13,983 --> 00:09:16,799
The update function happens 60 frames per second
184
00:09:17,055 --> 00:09:17,823
So
185
00:09:18,591 --> 00:09:20,127
Every time he reads this line
186
00:09:20,895 --> 00:09:22,175
He's going to move
187
00:09:22,687 --> 00:09:24,991
Relative to his current x position
188
00:09:25,759 --> 00:09:26,527
Plus 1
189
00:09:27,039 --> 00:09:29,855
We just keeps going over and over
190
00:09:30,111 --> 00:09:31,135
And over again
191
00:09:31,647 --> 00:09:33,951
And that's what causes a player to move to the right
192
00:09:34,463 --> 00:09:36,511
So that's why you use the update funk
193
00:09:37,279 --> 00:09:40,863
Are you going to write a lot of script inside of the update function
194
00:09:41,119 --> 00:09:44,447
This is where you spend the majority of your time writing scripts
195
00:09:44,703 --> 00:09:45,983
Especially games
196
00:09:46,239 --> 00:09:48,287
A lot of stuff happens within the update
197
00:09:48,543 --> 00:09:49,823
Going to spend a lot of time
198
00:09:50,079 --> 00:09:51,103
Inside of the update
199
00:09:51,615 --> 00:09:54,175
So quick recap year just to clarify
200
00:09:54,687 --> 00:10:00,588
Press the actually write script for a unity game we need to use these namespaces I cannot worry about him too much so
201
00:10:00,589 --> 00:10:02,760
Subtitled by
-♪ online-courses.club ♪-
We compress knowledge for you!
https://t.me/joinchat/ailxpXoW3JVjYzQ1
202
00:10:02,761 --> 00:10:04,159
Just going down and we're going to declare
203
00:10:04,927 --> 00:10:06,975
A public class called player
204
00:10:07,487 --> 00:10:09,279
That extends to the monarch behaviour
205
00:10:09,791 --> 00:10:12,863
Pretty much every script the right is going to extend to something
206
00:10:13,119 --> 00:10:15,679
Most of them are gonna extend to the money behaviour
207
00:10:16,191 --> 00:10:18,751
You really don't need understand anything more than that
208
00:10:19,519 --> 00:10:22,591
Is a public class motorbike about public and private in the future
209
00:10:23,103 --> 00:10:25,919
And unity is going to start reading the Script
210
00:10:26,687 --> 00:10:27,967
The moment you hit play
211
00:10:28,223 --> 00:10:30,527
He's going to restart and he's going to say you know what
212
00:10:31,039 --> 00:10:33,087
I need to write hello into the console
213
00:10:33,599 --> 00:10:37,439
I'm only going to do it once though because the start function only happens once
214
00:10:37,951 --> 00:10:39,999
Is it immediately jump to the update
215
00:10:40,255 --> 00:10:40,767
Function
216
00:10:41,023 --> 00:10:43,327
Because he's constantly in this up
217
00:10:43,839 --> 00:10:48,191
We're going to be able to do things inside this update over and over and over again
218
00:10:48,703 --> 00:10:52,543
So transformed at position is going to equal my current position
219
00:10:52,799 --> 00:10:53,567
Plus 1
220
00:10:53,823 --> 00:10:55,615
Is going to have an over and over and over again
221
00:10:56,639 --> 00:10:57,919
So hopefully that's clear
222
00:10:58,175 --> 00:11:02,527
And we can move on to actually simplifying this line of code a little bit more
223
00:11:03,295 --> 00:11:08,671
Instead of writing transform that position = the transformed up position that x
224
00:11:09,183 --> 00:11:10,975
We can actually just put a plus right here
225
00:11:11,743 --> 00:11:13,023
And then remove this
226
00:11:13,791 --> 00:11:16,863
That is a match simple way of writing
227
00:11:17,119 --> 00:11:19,167
Pretty much exactly what you just saw
228
00:11:19,679 --> 00:11:23,007
Play The Night you gonna use plus equals all the time
229
00:11:23,775 --> 00:11:27,871
A good way of thinking about plus equals is it basically is synonymous with advanced
230
00:11:28,127 --> 00:11:29,407
Now to be clear though
231
00:11:29,663 --> 00:11:33,503
This one unit is actually relative to the speed or the
232
00:11:33,759 --> 00:11:38,111
Efficiency of the computer or console did the players on
233
00:11:38,367 --> 00:11:44,511
So in order to ensure that were not moving at different rates across different frame rates on different computers
234
00:11:44,767 --> 00:11:48,607
Anytime you're iterating like this anytime you're moving something at a speed
235
00:11:48,863 --> 00:11:50,399
You always want to multiply
236
00:11:50,655 --> 00:11:51,679
Bye time
237
00:11:52,447 --> 00:11:53,727
Delta time
238
00:11:54,495 --> 00:11:56,287
Basically that means one second
239
00:11:56,543 --> 00:11:57,823
So we're gonna move it
240
00:11:58,335 --> 00:11:59,103
1 unit
241
00:12:01,407 --> 00:12:07,551
Because I'm a lemon I'm not going to tell you I know what this means I just know that the moment you multiply a number
242
00:12:07,807 --> 00:12:09,087
X x at delta time
243
00:12:09,599 --> 00:12:11,135
It means that the speed
244
00:12:11,647 --> 00:12:13,183
Your object is moving
245
00:12:13,439 --> 00:12:17,023
Or rotating or scaling whatever your iteration is
246
00:12:17,279 --> 00:12:21,375
That speed is no longer dependant on the computer
247
00:12:21,631 --> 00:12:22,655
Or the framerate
248
00:12:22,911 --> 00:12:23,679
That is being you
249
00:12:24,447 --> 00:12:25,471
But it's saviour
250
00:12:25,983 --> 00:12:27,775
Go back in the unity and deploy
251
00:12:29,567 --> 00:12:30,847
So now he's moving
252
00:12:31,103 --> 00:12:32,127
How much lower
253
00:12:32,383 --> 00:12:33,151
But that's ok
254
00:12:33,407 --> 00:12:36,479
Are we going to do is maybe change the speed to what's a bye
255
00:12:37,503 --> 00:12:38,271
It save
18712
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.