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
So what the heck are we looking at
I know it's confusing it's really not that confusing so basically what happened was
Unity
Put together a template for us
This is basically a c-sharp template this is how all of your script to go to start
When you create the
First
Appear when I get a worry too much about what's going on but these are just called namespaces
Honestly were just gonna scroll down I just ignore it for now
So this is really
The meat of our Sky
Basically what happening is
You're saying
There is a class or
Another way of thinking of it is there is a script
Dad public in will talk about what public and private mean
That's called player
This calling means it extends to the monobehaviour
Subtitled by -♪ online-courses.club ♪- We compress knowledge for you! https://t.me/joinchat/ailxpXoW3JVjYzQ1
The manor behaviour is basically
In layman's terms
The foundation or the root level
Of
What makes a unity script in unity c-sharp script
There's certain properties that we can use because we're extending
To the Manor behaviour
When I got way too much about it
I know that already that sounds confusing why is this a colon why is that green what's a monobehaviour
Why is the class blue
Used to all these Colours as you continue writing scripts and don't get too bogged
Down in the minute details right now
All you need to know is that unity created a script for us and that's script through this
Template in front of us
In that template basically said
Hey this is a script
Call Claire
And it is a monobehaviour
Can you tell me TVs curly brackets
Does an opening and closing bracket as well
The dad of lime here to show
Hey all of this is one set here and what is that set well it's the public class play
So this curly bracket is immediately going to start telling unity
Hey all of this continent here
Is part of the public class player
You let mine and make perfect sense but just bear with me when she keep going
Before we talk about what voidstar does in void update us explained
How unity read The Script
Pic of universe
Being here really
Fast speed reader
Is going to read using system start collections then is going to jump to using systems that collections that generic
He's going to move down to using unity engine
And then he's going to hit this
He was going to say ok
The something called a player
M&S going to hit this
Which is the star
In basically what this function does in unity this function through pretty much every c-sharp script you write
The very beginning working at tell unity
To do something the moment we hit the start button
Tell us about a quick script here
Don't get too in the weeds here just follow along as best you can
Debug
That log
Hello
And you'll see a red squiggly there that means we need to close out this
Sentence
Or
Statement
With a semicolon
I would say about the Script
And you're back in the universe
Wait for it to compile
Everything was good will have any errors being thrown in the console that's good
Now I want to do before we hit play
Is it gonna make sure we drag this script onto a game on
Search create
3D object
What's a ECU
Let's put it as 000
How to make sure camera is also a 0 position
-10 z-axis is good
You must be sure to rename rq player
I'm going to drag x
And as you can see the player script
Is on the inspector tab so now it's a component
I've player so we have the mesh filter of the mesh renderer
The box Collider and also the player script we just create
Square head in hip play
As you can see in the console window
We have
Printed the word hello in print is just a fancy word of saying display or right
So that's what this
Wirral line Deirdre debug.log
Hello
By the way too much have the same tax year just know that that was the point
Of this function start
Unity will read this and go ok I need to do something
When we start the unity player
Any me later read this and say you know what I'm gonna print hello in the console
Unity is never going to fire this function again ever
He's never going to do this again
It only happens when I seen loads
So that's the benefit of start
Wigan position the player here
We can spawn DayZ object
We can set the health to zero
We do all sorts of cool things the moment the game begins
Now the update function is pretty much
The opposite of what started is
Update says do this over and over and over again
60 frames per sec
Again ticket unity as a really fast speed reader
Once unity gets passed the start function
He continues to read down
He says
Here is an update function
I'm going to read this
Forever
And ever and ever at 60 frames per second
So he's going to read down it
Any backup
Again and again and again and again
The question is why on earth would we want to do that
Any engineers well that's how we actually have stuff happening in a game
To resemble we can move the position of the player
Every iteration
Search write a script to better understand what the update function is actually do
First begin to write a little comment here the way you comment in a script is
Two slashes
Move
Me to the right
One you
So there's a comment so now let's try and write a script that achieves that comment obviously
How to read a comment for every screen
But comments help you better understand what you're writing
To the way we do this is something like transform
That position
Equals
New vector3
1
0
Zara
And just remember
You want to end every statement with a semicolon
Theresa Lee
We cannot access the transformer components
My inspector
And we can access the position portion of that transform so that's transformed at position
And we're going to set it to
A vector3 in what a vector3 is basically a position
Acts of 1
Why is 0nz a 0
We had save jump back in the universe
The notice
We'll have any errors as go ahead in clear the console
That's it play and see what happens
Noticed that his position is now set to 1 so did exactly what we wanted it to whatever you wanted to have it
Move to the right
Over and over and over again currently
It's just been set to 1
It's not actually moving what the way we achieve this is when we move it
Over 1 unit relative to its previous position to the way we will do that is
Transform
That position x + 1
Search try and understand what this line actually means
Basically I want my position
2 equal
My current x position
Plus 1
What save this song
And see what happens
There goes
Zoom out really far here
Guess he's moving pretty fast
Now why is he continually doing
Well the reason why is if you jump into the Script what currently happening is
Unity is reading this line
Over
Andover
In over again
Why is he not reading this line well that's because he knows that the start function only happens once
The update function happens 60 frames per second
So
Every time he reads this line
He's going to move
Relative to his current x position
Plus 1
We just keeps going over and over
And over again
And that's what causes a player to move to the right
So that's why you use the update funk
Are you going to write a lot of script inside of the update function
This is where you spend the majority of your time writing scripts
Especially games
A lot of stuff happens within the update
Going to spend a lot of time
Inside of the update
So quick recap year just to clarify
Press the actually write script for a unity game we need to use these namespaces I cannot worry about him too much so
Subtitled by -♪ online-courses.club ♪- We compress knowledge for you! https://t.me/joinchat/ailxpXoW3JVjYzQ1
Just going down and we're going to declare
A public class called player
That extends to the monarch behaviour
Pretty much every script the right is going to extend to something
Most of them are gonna extend to the money behaviour
You really don't need understand anything more than that
Is a public class motorbike about public and private in the future
And unity is going to start reading the Script
The moment you hit play
He's going to restart and he's going to say you know what
I need to write hello into the console
I'm only going to do it once though because the start function only happens once
Is it immediately jump to the update
Function
Because he's constantly in this up
We're going to be able to do things inside this update over and over and over again
So transformed at position is going to equal my current position
Plus 1
Is going to have an over and over and over again
So hopefully that's clear
And we can move on to actually simplifying this line of code a little bit more
Instead of writing transform that position = the transformed up position that x
We can actually just put a plus right here
And then remove this
That is a match simple way of writing
Pretty much exactly what you just saw
Play The Night you gonna use plus equals all the time
A good way of thinking about plus equals is it basically is synonymous with advanced
Now to be clear though
This one unit is actually relative to the speed or the
Efficiency of the computer or console did the players on
So in order to ensure that were not moving at different rates across different frame rates on different computers
Anytime you're iterating like this anytime you're moving something at a speed
You always want to multiply
Bye time
Delta time
Basically that means one second
So we're gonna move it
1 unit
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
X x at delta time
It means that the speed
Your object is moving
Or rotating or scaling whatever your iteration is
That speed is no longer dependant on the computer
Or the framerate
That is being you
But it's saviour
Go back in the unity and deploy
So now he's moving
How much lower
But that's ok
Are we going to do is maybe change the speed to what's a bye
It save
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.