- Home /
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 !
There is no reason it wouldn't work (well at least not for that reason). Could you please show us your script so we can help you find what's wrong with it ?
Answer by Mikozouzou · Nov 23, 2016 at 06:25 PM
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 !
Your answer
Follow this Question
Related Questions
Display a loading while processing a while loop 1 Answer
while loop works in editor, stuck on iOS 1 Answer
Loop problem 2 Answers
Making A 4 Barrel ShotGun! Need Some Help - UPDATE 3 Answers
wierd infinite while loop 1 Answer