Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Unity Basics!
You have completed Unity Basics!
Preview
It’s time to see some feedback from our code. Let’s get Mike the Frog flying!
Unity 6 Documentation
Resources
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
If you remember, all of the physics
affecting our player is coming
0:00
from this Rigidbody2D component.
0:01
So in order to affect this component
in our code,
0:03
we need to get a reference to it.
0:06
There are two common ways
to do this in Unity:
0:08
doing it directly in our code,
and assigning it in the Unity editor.
0:11
We'll learn and use
both multiple times in this course,
0:15
but we're going to start with
the code approach.
0:18
So first, we need a variable
0:21
that will eventually store
our Rigidbody component.
0:22
To do this,
we need to supply it three things:
0:26
the access modifier, the data type,
and the name that we want to give it.
0:29
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up