parent Transform.position unexpected behaviour when changing position


I’m having some trouble with an unexpected behaviour of changing the position of a gameobject.

I have a gameobject, called worldobject, which holds two components, WorldManager and WorldDrawManager.
After the calculations of the world data is completed (i’m creating an icosphere), WorldManager calls WorldDrawManager to draw all world chunks (each face of the original icosahedron is a chunk) as new gameobjects whose parent is worldobject and position is

Now, everything works fine when the gameobject is at position (0,0,0), but when I change the position of said object (for example at 0,-100,0) the icosahedron gets STILL drawn around the (0,0,0) origin point. The chunk objects’ positions are each shown as (0,100,0), even if I explicitly set them to

Inspecting worldobject before I start the game shows its gizmo at the correct position, but after I complete the world generation its gizmo is shown at (0,0,0) even if its position in the component is correctly set.

Is this a bug or am I doing something wrong?

Thanks in advance!

Your are instantiating them using world position instead of your object relative position.
You can

  • use transform.localPosition to set the position
  • calculate the desired position relative to the parent
  • positioning the parent at 0,0,0, then instantiate all objects, then move it again to wherever it was.

Your choice.