DrawMesh and MaterialPropertyBlock fails

First, please bear with whatever silly beginner’s misunderstandings from my part, plus that I strongly believe I miss something basic here.

I try to use DrawMesh in order to create multiple spheres with different material properties by supplying a MaterialPropertyBlock, but the spheres are rendered with identical material (although they are not dynamically batched). The code is like this:

void Awake()
{
    //Where random values are defined for the Transformation matrix, Base color, etc.
}
 
void Update()
{
    if (block == null)
    {
        block = new MaterialPropertyBlock();
        block.SetVectorArray(baseColorId, baseColors);
        block.SetFloatArray(metallicId, metallic);
        block.SetFloatArray(smoothnessId, smoothness);
    }
    //Below is my non-working code
    for (int j = 0; j < matrices.Length; j++)
    {
        Graphics.DrawMesh(
            mesh, matrices[j], material,
            0, null, 0,
            block,
            ShadowCastingMode.On, true, null,
            lightProbeVolume ? LightProbeUsage.UseProxyVolume : LightProbeUsage.CustomProvided,
            lightProbeVolume
        );
    }
}

My understanding is that the for loop is performing as intended, but the renderer renders all spheres with the properties of the last (I assume) iteration. I skip the rest of the code, which I know it works fine as it is borrowed from a tutorial (catlike coding) with the only difference being that the DrawMeshInstanced function is used instead. In my case I cannot use the latter due to my system’s gpu.

Do I have to use Coroutines in this case? Any suggestion?

It seems like you send the arrays to the shader to access per-instance properties, but if you don’t use instanced rendering, your shader will always be using the first element in the property arrays you’re assigning with the property block, as it’s always rendering ‘the first instance’ with Graphics.DrawMesh(). If you instead set the property block values inside your loop, and make the shader use a singular value instead of an array, it might work.

Some pseudocode of that might be:

for (int j = 0;  j < matrices; j++) 
{
     block.SetFloat(baseColorId, baseColors[j]);
     block.SetFloat(metallicId, metallic[j]);
     block.SetFloat(smoothnessId, smoothness[j]);

     Graphics.DrawMesh(mesh, matrices[j], material, properties:block);
 }

You would have to change your shaders to use single properties instead of an array of properties, though.