Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialjohn knight
Courses Plus Student 9,155 PointsCan someone help me?. I couldn't understand the private and animator syntaxes. Can anyone Help me?
Can someone help me?. I couldn't understand the private and animator syntaxes. Can anyone Help me?
1 Answer
Samuel Savaria
4,809 PointsBasically, the 4 variables he declared in the beginning of the video all follow the same syntax. They each have am access modifier, a type and a variable name.
The access modifier is used to determine which classes and methods can access this variable. Private simply means that only methods inside the PlayerMovement method can call and access this variable.
The variable type is basically the role of the variable. For exemple, type string is used to store text, and type integers is used to store whole numbers. Animator is a variable type that is used to control the animation of the 3D model.
The variable name is simply used to distinguished different variables of the same type, like moveHorizontal and moveVertical. There are naming conventions tho, so you get bonus point if you use underscores before private variables (_playerAnimator).
Sorry for the late response, hope this helps, Cheers.
john knight
Courses Plus Student 9,155 Pointsjohn knight
Courses Plus Student 9,155 PointsNo Problem!. But Anyways Thank You.
Samuel Savaria
4,809 PointsSamuel Savaria
4,809 PointsGlad it helped :)
I hope my occasional tangents didn't distract you too much from the real answer.