It seems that I cannot update by script localPosition or position after I have parented a gameobject to another scaled gameobject at runtime.
The position coordinate shows up as the same in the inspector even after applying several different position and localPosition changes by script.
How do you update the localPosition by script of a gameobject that is a child of a parent gameobject?
The localPosition is relative to the parents coordinate space. If you scale your parent for example to 0.01 on each axis, the local coordinate space is shrinked by a factor of 100.
That means, assuming that the parent is at position 0,0,0 in worldspace, a childobject at 200,0,0(local space) will be at 2,0,0(world space).
Your question isn’t really clear what actually happens. Do you mean that even when you assign a new position (no matter if local or global) the position doesn’t change? In this case you propably have either:
- a scale of 0.0
- another script or code fragment that continously resetting the position
- or an Animation attached that animates the position to be at a specific position.