When should I use public, private, or [SerializeField]? Unity C#
问题 When should I use public, private, or [SerializeField]? which is the most practical? 回答1: First, you need to make sure you understand the difference between public and private variables. Here's the official documentation for different access modifiers. I strongly recommend you read through it, but a simple version would be that public variables can be referenced by other classes, while private variables cannot. Imagine if you have a Player class with a Health field. Let's assume that by your