OnValidate with Start can not be in sync. What is the trick here?

Hi,
i have a problem with getting mesh at runtime. If i add OnValidate unity gets angry to me and says no reference about vertices. But if i make it inactive (OnValidate) then everything works as it must work. What is the trick here? Can you help me please? ^^

//Listen each variable and update after the changes
private void OnValidate()
{
    if (numberOfRandomVertexPoint != _lastNumberOfRandomVertexPoint)
    {
        GetRandomPointFromMesh();
        _lastNumberOfRandomVertexPoint = numberOfRandomVertexPoint;
    }
}

private void Start()
{
    _mesh = GetComponent<MeshFilter>().sharedMesh;
    _vertices = _mesh.vertices;
}

[ContextMenu("Get Vertices")]
public void GetMeshPoints() 
{
    vertexPoints.Clear();
    for(int i = 0; i < _vertices.Length; i++)
    {
        vertexPoints.Add(_vertices[i]);
    }
}

Problem is happening in GetMeshPoints() method when it tries to mesh.vertices into vertices array that i defined. I found a solution in unity forum but i didnt convice. _vertices access modifier requires to be public or serialized for example [HideInInspector] [SerializeField] private Vector3[] _vertices; but why? And here the error message NullReferenceException: Object reference not set to an instance of an object
RandomPointSpawner.GetMeshPoints () ^^

This code will throw NullReferenceException: Object reference not set to an instance of an object
in one of two cases:

  1. vertexPoints is null
  2. _vertices is null

You provided no code of how you handle vertexPoints but reading from your code _mesh is null because OnValidate() is Editor-only method (executed when Inspector field changes, for example) and so executes before Start() where you change it’s null value to _mesh = GetComponent<MeshFilter>().sharedMesh;

//Listen each variable and update after the changes
#if UNITY_EDITOR
void OnValidate ()
{
    if (numberOfRandomVertexPoint != _lastNumberOfRandomVertexPoint)
    {
        if( _mesh==null ) _mesh = GetComponent<MeshFilter>().sharedMesh;
        _vertices = _mesh.vertices;

        if( vertexPoints==null )
        {
            throw new System.Exception($"{nameof(vertexPoints)} is null, make sure it is not, here");
        }

        GetRandomPointFromMesh();
        _lastNumberOfRandomVertexPoint = numberOfRandomVertexPoint;
    }
}
#endif