Making variables public just to facilitate serialization in Unity is an anti-pattern and should be avoided in my opinion. I like using the [SerializeField] attribute instead. That way, you can have private variables show up in the inspector while still exposing them with a property that has a public getter and a private setter in C#. It looks like this:
public int Test { get { return test; } private set { test = value; } }
[SerializeField]
private int test = 0;
[field: SerializeField] public float moveSpeed { get; set; }
And you even do things like this, where you can add headers in the inspector to work with this shorthand, set default values, and make the set private: