GameObject position and localPosition not changing in hiearchy, only in script.

I have a prefab i instantiate, and when i change its position and local position to 0,0 it doesn’t seem to change in hierarchy view in editor. I have a debug system that prints out values to a gui text object and it says the local position before and after is 0,0. But in the editor it is a random huge value. Why would this be?

I’m using this code to change its positions:

	debugGText.permDebug("pos: (" + transform.position.x + "," + transform.position.y + ")");
	transform.position = Vector3.zero;
	debugGText.permDebug("pos(after): (" + transform.position.x + "," + transform.position.y + ") and localPos: (" + transform.localPosition.x + "," + transform.localPosition.y + ")");
	transform.localPosition.Set(0,0,0);
	debugGText.permDebug("localPos: (" + transform.localPosition.x + "," + transform.localPosition.y + ")");

This code works fine with no compile errors and print sout the location to the gui text object.
Here is a screenshot of this in the editor window(I highlighted notable parts):
There are no null reference exceptions and the script is on the gameobject i wnat to modify. Notice that the gameObjects’s transform only has localPosition and not normal position. Why is this? It is not a child of another object…Just a prefab.

In you full script you have this code:

 private void updateTextPos()
    {
        Vector3 worldLocation = mainCam.ScreenToWorldPoint(buildGuiLocation);
        labelOfBuilder.transform.position = worldLocation;
    }

But labelOfBuilder is a component on the same game object as the Builder script, so it moves the builder to that location, hence your changed coordinates.

https://companynamegenerator.net