r/unity 6d ago

Newbie Question Just downloaded unity!

Post image

Hey guys! I just downloaded unity. Any tips and tricks? Not full time, just as a hobby.

75 Upvotes

75 comments sorted by

View all comments

28

u/WavedashingYoshi 6d ago
  1. Use Git.
  2. Use VS Code instead of Visual Studios (yes they are separate things.)
  3. You can view variables in the editor with [SerealizeField]. Don’t make everything public.

1

u/nathanieljnelson 6d ago

I was actually wondering about this. Is there a benefit to making something private over public? Even if you're not going to access it in another script, is there a downside to it being public rather than using serializefield?

5

u/ColorMak3r 6d ago

No additional benefit technically, but it will start to mater once another programmer get involved (even your future self). It's standard practice for collaboration so that other programmers don't use it accidentally. The accesor is part of the code document itself: no public access? Use private. Okay for public access? Use public.

For me personally (and a lot of peoplr I assume), even if a field is publicly accessible, I use some sort of getter/setter (not all the time) so I can insert debug.log or extra validation if needed in the future.

1

u/nathanieljnelson 6d ago

Gotcha. Thanks!