❔ Align items Sprites in Unity

Hello I just started with Unity and I wanna create a character selection menu from scratch. Both these items have Position X on 0, why are they not aligned?
13 Replies
Florian Voß
Florian VoßOP2y ago
i want the character to be centered in relation to the Text I thought if both have position x of 0 that should work but it doesn't
Buddy
Buddy2y ago
Because that is world coordinates
Florian Voß
Florian VoßOP2y ago
so what do I have to do to get the expected result?
Buddy
Buddy2y ago
use UI
Florian Voß
Florian VoßOP2y ago
I think I am using UI unless I missunderstand you. The text is a UI > Canvas > Text component
Buddy
Buddy2y ago
Sprite Renderer is not UI If it would've been UI, it wouldn't be a Transform, but a Rect Transform
Florian Voß
Florian VoßOP2y ago
the sprite renderer is from the character sprite. The text does have Rect Transform
Buddy
Buddy2y ago
use Image if you want to display something on the UI
Florian Voß
Florian VoßOP2y ago
i set font size on the text to "Auto Size", looks much better now. Is it alligned now?
Rainys
Rainys2y ago
yeah, also make sure to set the font allignment to center, both the vertical and horizontal one, and also what was the guy trying to tell you is that: all canvas' children have a Rect Transform, you have a Transform, and for UI Rect Transforms are a life saver mainly because you can anchor/allign things easily
Florian Voß
Florian VoßOP2y ago
yeah whats confusing for me is that when I have position x 0 in the rect transform of the title and position x 0 in the regular transform of the character sprite, they don't seem to be perfectly alligned. Maybe my eyes are lying to me here
Rainys
Rainys2y ago
also make sure the anchor is centered because it should be centered, unless like the image is not centered or something
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server