- Home /
Quick Question on UI Text Alignment
I need to occasionally print large amounts of text to my screen, columns and rows, several columns and several rows each time (it will vary). It needs to be aligned (right aligned, decimals, etc) so it looks neat, ideally showing the text on a solid white background so it can be read easily.
C# outside has "FlexGrid" and so forth that I've used previously but I'm not sure what the equivalent is inside Unity. I just watched the Unity tutorial on "Panels" and a couple others and they show examples for specific uses but so far none have shown anything resembling FlexGrid, etc.
Would someone be so kind as to steer me in the proper direction? I'll continue to look online in the meantime and I thank you in advance for any assistance.
I don't expect anyone to do my homework for me. I'm just looking for some tutorials/videos to look at so I can learn how to do it.
$$anonymous$$y problem is that I don't even know where to begin to find the information I need.
Thanks again.
Answer by ElijahShadbolt · Apr 10, 2018 at 08:53 PM
Check out the manual for Auto Layout in Unity UI. They can be hard to wrap your head around, but incredibly useful. Children of a HorizontalLayoutGroup act as columns. Children of a VerticalLayoutGroup act as rows. You can specify the preferred width/height of a child with the LayoutElement. With these tools you can combine columns and rows in a hierarchy like so:
v Columns (HorizontalLayoutGroup)
> Rows in Column 1 (VerticalLayoutGroup)
> Rows in Column 2 (VerticalLayoutGroup)
v Rows in Column 3 (VerticalLayoutGroup)
- UI Element (text, slider, etc.)
- UI Element
- UI Element
The alignment property of a Text element is also useful.
Thank you, I'll look at that right now. I appreciate that you took the time to help me.
I'm going to go ahead and accept this answer. I've been looking at it off an on over my afternoon and it seems to fit my needs. You were correct about it being difficult though. It's going to take me some experimentation before I can really put it to use. Thanks again.
Your answer
Follow this Question
Related Questions
How do I obtain children on UI canvas text 0 Answers
How do I change scene with two ui canvas text 2 Answers
,InputField backspace returns already send text 0 Answers
How to display UI Text on GameObject in script? 0 Answers
UI fade with CanvasGroup vs of Image.color.alpha or Text.color.alpha performance 1 Answer