(Firstly, sorry for the stupid question)
I watched couple of official tutorials lately and just noticed most people on tutorials on YouTube or Unity Official Tutorials don’t use [serializefield] to make a private variable editable in the inspector window and instead uses “public” access for everything that needs to be editable by the inspector even if they don’t need to be accessible by other scripts. These tutorials are done by working professionals, so my understanding about this must be wrong.
I use serializefield a lot and the documentation and google search gave me the impression the only thing I needed to know about this is
- public access modifier for fields that needs to be accessed from other scripts
- private for private fields
- [serializefield] private - for fields that needs to be modified from inspector but wont be accessed by other scripts and helps keeping the code clean.
So, are there any reason even unity official tutorials avoid [serializefield] like a downside to using them or am I overusing it by mistake.
(Again, sorry for the stupid question, assuming it is one since couldnt find any answer on google)
Link for reference to what I am talking about: