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
Let’s learn how to detect when the player hits a pipe obstacle.
Unity 6 Documentation
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
This means that in our code,
we need to detect
0:00
when the player collides with something.
0:01
But the player can also collide
with the ground and our invisible player
0:03
bounds up top,
0:06
so we need a way to make sure it's a pipe
that they're colliding with.
0:08
There are numerous ways to do this,
but the most simple way I know of
0:11
is using tags.
0:15
It's also not as taxing
on your performance as other options.
0:16
Tags in Unity are just labels
you can assign to game
0:20
objects
for easy identification and grouping.
0:23
If we select a game object
in our hierarchy and look just beneath
0:26
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