Transform vs UiTransform

(Max Yankov) #1

I’m a bit confused about the distinction between Transform and UiTransform in Amethyst. I understand the motivation behind it: UI positioning is a different (and much more complicated) task than just usual game object positioning in the scene. However, I’m still confused about how they play with one another:

  • Is UiTransform required to render ui elements like text (it does seem like it, but I haven’t found this requirement explicitly documented)? Can I render text on an entity that only has a simple Transform, may be with components outside of ui module?

  • If an object has UiTransform as well as a simple Transform, how do they work with each other? I expected that they would share information somehow, but it seems as if they’re completely independent of one another…

  • What’s the current solution where sprite and text need to be reliably linked on a screen — do people just copy coordinates from Transform to UiTransform every frame?

0 Likes

(Joël Lupien) #2

I’m currently working to completely remove UiTransform.

If you have Transform + ScreenSpace components, they will render using the position on the screen, exactly like UiTransform does it.

Text, on the other hand, is only rendered when using UiTransform + UiText. This will be changed soon to use Transform + UiText + ScreenSpace instead.

In the meantime, if you want to render text next to a sprite, the easiest way is to add a ScreenSpace component on your sprite, and render text using UiText + UiTransform.

2 Likes