unity – What’s the best way to draw gizmos in build

Gizmos are for development, not for playing. The usual approach to implement a gizmo would be to create a gameObject representing said gizmo which you activate and deactivate as needed.

So instead of:

if (isDragging) {
     Gizmos.DrawCube(dragPosition, dragSize);
}

You write:

if (isDragging) {
     myGizmo.SetActive(true);
     myGizmo.transform.position = dragPosition;
     myGizmo.transform.scale = dragSize;
} else {
     myGizmo.SetActive(false);
}

While this seems a bit more convoluted, think of all the possibilities you have when your gizmos are full-fledged gameObjects which can have any kind of visual and logical components you want.