why not just define the variable as public instead of SerializeField?
1 Like
Hi Rafael,
The public access modifier makes a variable accessible for everything that has a reference to this object. In larger projects, this could make debugging very difficult because if “everything” can access “everything”, you have to check everything. For this reason, it is good practice to make things private whenever possible because that makes debugging way easier. In this case, our variable is private.
Did this clear it up for you?
See also:
- Forum User Guides : How to mark a topic as solved
5 Likes
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.