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 trial

Game Development Cameras in Unity Camera Movement Adding Camera Bob

Ranvir Sahota
Ranvir Sahota
9,844 Points

Why does storing local position make script reusable?

At around 1:54 Nick says that Sorting the local position of the game object make it reusable if it's parented to other game objects. But why is this?

1 Answer

Alan Mattanó
PLUS
Alan Mattanó
Courses Plus Student 12,188 Points

The local position is the position of that particular game object where the script is attached to. If you use that script as a component of another second game object, the local position will be the local position of this new second game object where this script is attached to. The "transform" in lower case is the reference to the game object where this script is attached to. The ".localPosition" is the value of the position (Vector3) in relation to the parent (local position and not to the world position).