Can I use a while() in the function OnDrawGizmos() ?

Hi,

I want to display a sphere gizmo around a gameObject in my scene (in editor mode, not while playing) at a random position, but only on a defined area.
Before drawing the gizmo, I’m using a while() to check if the random position isn’t into the defined area. If it isn’t, a new random position is picked until the position is correct.

This is working in playmode in another script (not as a OnDrawGizmos function), but it seems that the while isn’t detected in editor mode in my OnDrawGizmos function.

Do you have any idea if I can use a while in this function ?

Thanks !

I found the answer, the problem came from my verification : my conditions were written with && instead of ||, quite simple but as I tried several things at once I missed it !