When I use for into do while Unity, begin Freeze
Hey Guys !
Anyone know me say why when I use this code Unity every time is freeze ?
What is wrong ?
I want that Do while will be repeating generating numbers into array until array will be passed from testing function Straight and Straight return TRUE.
Thanks so much !
Answer by MacDx · Jan 31, 2018 at 07:18 PM
Maybe Straight() is always returning false. Hard to know without looking at the code.
Answer by Commoble · Jan 31, 2018 at 08:26 PM
If that loop is an infinite loop, then Straight() is always returning false. If Straight() is not always returning false, then that loop is not infinite -- either it's merely taking a very, very long time, or a different loop is being infinite.
Consider this: if you're randomly generating numbers into that array until it becomes a particular sequence, it may take a very very long time to reach that sequence, depending on the sequence you're testing for.
It should be non infinity loop, because yes numbers are generating until Straight() will return TRUE and yes it can be long process. Any ideas how can I do it ? Because i need numbers which will be evaulation like true from Straight()