While Loop Causing Unity to Hang

I have attached a picture of my code here.

I am wondering why the while loop does not meet its end condition (which in turn causes a crash). Can anybody help?

Note: The game only crashes when I apply values to the serialized fields.

you can use it like this.

Example:

IEnumerator Move()
{
    while(Vector3.Distance(transform.position, destinationPos)> 0.3f)

      { transform.position = Vector3.MoveTowards(transform.position, destinationPos, speed);
        yield return null; }
       
}

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms