while loop works in editor, stuck on iOS

Hi guys,

I have this piece of code.

    candy_currentLerpTime = 0
        			while(Candy[Index].transform.position.y > postDropPos.y && paused == false)
        			{
        				Candy[Index].transform.position = Vector3.Lerp (startPos, 
        				                                                    endPos, (candy_LerpTime+=Time.deltaTime));
        				yield return new WaitForEndOfFrame();
        			}

in Editor, the while loop moves the Candy and after it reaches its destination the loop exits.

When I build it on my phone (iOS) the while loop gets stuck

I debugged it while its stuck and this is the output:

  1. startPos = (-1.3, 5.0, 0.0)
  2. endPos = (1.3, -5.3, 0.0)
  3. Candy[Index].transform.position = (1.3, -5.3, 0.0)
  4. candy_LerpTime keeps increasing way past 1 because the loop is stuck
  5. Candy[Index].transform.position.y > postDropPos.y = true
  6. Candy[Index].transform.position.y == postDropPos.y = false
  7. paused = false

Can anyone tell me what’s wrong here?
How is Candy[Index].transform.position.y > postDropPos.y = true when both positions show same coordinates and how come this works in editor but not on the phone???

Thanks

I hope the code is in a Coroutine. Try using yield return null; instead of yield return new WaitForEndOfFrame();

Edit: That’s not even complete code and where is the postDrop transfom position coming from? No clue.