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 How to Make a Video Game Player Input and Cameras C# Variables and Classes

Jenny Veens
Jenny Veens
10,896 Points

C# Syntax Confusion

Hi, I'm a bit confused about the C# Syntax - I'm hoping someone here will help me out.

Why do sometimes the parentheses get a space before them, as in 'Start' and the variable playerAnimator:

void Start () {
        playerAnimator = GetComponent<Animator> ();
        playerRigidBody = GetComponent<Rigidbody> ();
    }

And sometimes they are used directly after, as they are here after the List:

private List<AudioClip> soundClips = new List<AudioClip>();

Thanks in advance!

1 Answer

Justin Kraft
Justin Kraft
26,327 Points

Correct me if im wrong, but I believe this is a default setting in Unity. The function declaration and call should still work properly with or without spaces. White space in almost all languages is ignored by a compiler.

Jenny Veens
Jenny Veens
10,896 Points

Thanks Justin, I hope that's the case. I'll try running the code with and without spaces to see if it makes a difference.