I would like to ask about differences on using a public Variable ex : public float;
And uisng [SerializedField] float
in the unity the result looks the same
I would do some reading on data encapsulation.
The difference is one is public and the other is private, all public variables are exposed to the Unity inspector where private variables are hidden, [SerializeField] exposes private vars so you can tune them ingame. It is highly recommended you use SerializeField over public.
It’s one of those things that doesn’t make sense at first but later will under stand and will be glad you learned the right way!
Thank you for the information!
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.