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

My private Transform player; is not showing up in unity.

I cant add the player to the transform inside unity becuase the private Transform player; wont show up in the script inside unity.

Hi Kincade, Could you perchance send the link to the video you are working on? I'm sure I can help you, it's been a while since I've done that course. Cheers, Gabriel

1 Answer

That's becaus private properties don't show up in the Unity editor. You either have to set it to public or specify in your code you want a private value to be visible in the edtor. You can do that by adding the [SerializeField] tag right before the property.

For more information about SerializeField you can check out the Unity documentation here: https://docs.unity3d.com/ScriptReference/SerializeField.html

Best of luck!