Line Renderer and Sprite Z-coordinate always 10?

This is the weirdest thing. I set the sprite’s Z coordinate in every update. I check it at the start and at the end, but it is always 0 when I print out the transform.position. However, when I look in the inspector, the Z coordinate for this object is always a 10. I never manually set the value to any other than a 0, yet it is a 10.

This causes an issue. I use LineRenderer to render some lines and setting “Sorting Layer” on the Line Renderer appeared to have no effect on where it was rendered and thus, I’m using the Z coordinate. However, it magically turning into 10 is weird. Furthermore, the actual sprite being rendered is a child object of the magic object that goes to 10. (Weirdest part is that before and after the Update that moves the object, the value appears to be correct).

Anyone ran into anything like this before? I could give out some code, but I don’t even know what’s relevant here. Setting the position is always done with

this.transform.position = new Vector3(x, y, 0);

Does the sprite have a parent? The inspector displays the local coordinates while transform.position sets the global coordinates. To set the localPosition use transform.localPosition, i.e.

transform.localPosition=new Vector3(x, y, 0);