I've an Icosphere GameObject:
I want to iterate over each of the faces and change the material based on their distance from the center, however I don't seem to be able to retrieve the list of vertices for the object:
void Start()
{
// Works
_planetRenderer = GetComponent<Renderer>();
_planetRenderer.sharedMaterial = Materials.First(m => m.name == "Sand");
// Can't retrieve vertices
MeshFilter gameObjMeshFilter = GetComponent<MeshFilter>();
Debug.Log($"Center: {transform.position}");
Debug.Log($"Mesh Count: {gameObjMeshFilter.mesh.vertices.Length}");
}
The vertexCount is returned as 43530, but vertices is an empty array:


