I'm making an isometric-ish 2d game in Unity. I want to display text above a sprite during certain conditions. For this, I'm using a TextMesh instantiated as a child of the sprite.
In local space, this obviously means that when I rotate a sprite, its children rotate along with it. From the player's perspective, the label now appears to the side of the sprite, rather than staying above it.
I can always calculate the world space position of the TextMesh during LateUpdate(), but a) that solution requires a designer to know that a script will alter the local transform, and b) things built into Unity have more eyeballs on them, so I'd rather use that.
Is there a mechanism built into Unity such that I can set a child's transform in the inspector to e.g. position.y = 0.4
and have it render 0.4 units above the parent in world space? Edit: Additionally, I want it to follow the parent as it moves, so just calculating once on Instantiate()
isn't quite what I want either.
Vector3
that it uses to update the position of its game object. \$\endgroup\$