Position variable not updating

Hey everyone! I have recently noticed a very strange issue with the transform.position setter. When setting this in a LateUpdate function I have noticed immediately after setting a value it is not the desired value. Below is a small code snippet.

LateUpdate() {

    transform.localScale = new Vector3(0f, 0f, 1f);

    transform.position = new Vector3(0f, 0f, 0f);

    if (transform.position.x != 0) {
	    Debug.LogError("No change at X position: "+transform.position.x);
    }
}

In this snippet, the debug statement somehow get called. Does anyone have any idea why this may be occurring?

Make sure external scripts don’t change this value. Check for subtle errors. For example == and = might be playing a trick on you, and instead of comparing the variables, you change them, etc