Why use [SerializeField] on a private field?
[SerializeField] private int lives = 3;
- Expose it in the Inspector safely
- Make it public to all scripts
- Run it before the scene loads
- Compile it out of the build
It lets the editor edit a private field without widening its code access.
Play Game Dev ▸