'Why do await Task.Delay(10); stops execution in unity Web-GL?

I am using await Task.Delay(10); in unity C# for delay .After build and run in Web-GL format .The execution stops at this line that has delay .When I remove the delay it executes.

while (XAxiscurrentXpos <= -izvalue) 
{ 
    await Task.Delay(10); 

    XAxiscurrentXpos += 0.001f; 
    Vector3 posx = new Vector3(XAxiscurrentXpos, XAxisposition.y, XAxisposition.z); 
    XAxis.transform.localPosition = posx; 
}


Solution 1:[1]

I have solution by using UniTask. UniTask Link is here

Solution 2:[2]

So now knowing what you are actually trying to do instead of your task at all you rather want to use e.g.

public class MoveObject : MonoBehaviour
{
    public Transform XAxis;
    public float desiredUnitsPerSecond;

    // This is called once a frame by Unity
    private void Update()
    {
        if(XAxis.localPosition.x <= -izvalue)
        { 
            XAxis.localPosition += Vector3.right * desiredUnitsPerSecond * Time.deltaTime;
        }
    }
}

this moves your object with the linear speed of desiredUnitsPerSecond in its local right direction as long as it is left of -izvalue.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 aqeel
Solution 2