Help using Mathf.Max to find highest float in array of gameobjects

Hi, please can someone help me with the syntax here, I cannot get this to work.

Basically, I have a bunch of gameobjects in an array called blocksInPlay. Each gameobject has a script attached that manages a float called actualHeight.

I need to iterate through the array everyframe and find the highest height value and assign to a float called currentHeight.

I figured that Mathf.Max was the best solution, but I cant find the right syntax. Please can someone help, so far I have this:

        foreach(GameObject block in blocksInPlay)
        {
            blockScript = block.GetComponent<BlockManager>();
            if (blockScript.objectSettled == true)
            {
                currentHeight = blockScript.actualHeight;
            }

This above gives the total from all of them within blockscript, so how can I use Mathf.Max on the above?

var managers = blocksInPlay.Select(b => b.GetComponent());
currentHeight = managers.Where(b => b.objectSettled).Max(b => b.actualHeight);

But I’ll suggest to cache BlockManagers somehow to skip GetComponent() in Update.
If you receive array of gameObjects through inspector, you may just receive BlockManager instead of GameObject.

foreach(GameObject block in blocksInPlay)
{
blockScript = block.GetComponent();

    if (blockScript.objectSettled == true)
    {
        currentHeight = currentHeight > blockScript.actualHeight ? currentHeight : blockScript.actualHeight
    }
}