Gizmos.DrawSphere with a radius not known beforehand (not a constant)?

I have a simple custom plane object with a Height and a Width properties.
I want to draw a sphere, that will cover the plane object so I have to figure out if Height is greater than Width or it’s the opposite to determine the radius. In other words, I’m not passing a constant - I’m passing a value, that requires some logic to be done before hand to be done first, to get the right value. I did this, and I didn’t get any visuals:

private void OnDrawGizmosSelected()
{
	Gizmos.color = Color.red;
	Gizmos.DrawWireSphere(transform.position, Mathf.Max(Width, Height));
}

Of course if I explicitly tell it the radius (give it a constant) - it works.

Is there a way to do what I want? or this is just how it works? (the radius has to be a constant)

I tried sticking [ExecuteInEditMode] (doesn’t make so much sense but just a try) - it didn’t do anything.

Any ideas?

Thanks.

The DrawWireSphere() call works when you pass a literal value, so the issue may with the value returned by Max().

I recommend checking to see that all involved values are in the range that you are expecting i.e. a sanity check. Something like this would do.

using System;

// ....

float max = Mathf.Max(Width, Height);
Debug.Log(String.Format("Width: {0}, Height: {1}, Max:{2}", Width, Height, max));
Gizmos.DrawWireSphere(transform.position, max)