Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

[solved] Text alignment like Zelda BoTW / Mario Odyssey

A topic by mrtenda created Oct 29, 2017 Views: 686 Replies: 6
Viewing posts 1 to 7
(3 edits)

First of all, thank you for creating this amazing package! I've been finding it immensely useful so far!

So in the game I'm working on, I would like to align text in Super Text Mesh by both left-justifying it and centering it, like Zelda BoTW and Mario Odyssey do. Basically what these games seem to do is figure out what the total width of the text is going to be when it's left-justified, and then center it on the screen (and I am guessing that these games don't use auto-wrapping in order to make this all possible?). Here are some examples from Zelda that should explain what I mean:


(Here's also a video link: https://youtube.com/watch?v=CE8PS7r3IGM&t=7m59s )

I would like to imitate this behavior with Super Text Mesh, but I couldn't figure out how to do so from reading the documentation or experimenting with the alignment settings. Do you have any ideas? Thank you!

Developer

Hey! Good eye, never noticed this in specific.

Those variable wrap distances have gotta be put in manually, I think...? It's gotta just be manual line breaks I think. I can think of a way to do it automatically, but not a way to do it automatically and get good results every time.

If you're cool with manual line breaks, you can just set Super Text Mesh's anchor to be "Middle Center" (if you're using UI text, just align it "middle"), and then set the alignment to "left"? If autowrap is off (or on!) that should deliver the right result?


Also while testing this I realized that line breaks are acting pretty weird for middle-anchored text, so I'll be working to fix that shortly, sorry about that!

Amazing, that worked!! Once I applied the settings you suggested, and turned off auto-wrap, it all started working like I wanted it to. Thank you so much!

(4 edits)

Hello, I upgraded to the newest version of STM today (1.7.1), but I'm having trouble getting this to work, even though it was working in 1.6.3... I'm sorry, but would you be able to help me out once again? (Also, I hope it's okay that I reopened this thread rather than creating a new one, I just thought this way would be better since this thread has all the context)

I tried with both autowrap enabled and disabled (my game uses autowrap enabled, but I tried with both anyway). In STM 1.7.1, the text moves around as it's written, but STM 1.6.3 seems to correctly calculate beforehand where the text should go so that it doesn't move around as each new line gets written.

Is there a different way I'm supposed to do this in the newest STM? I've also attached some videos below which show the different behavior between the two versions of STM, with autowrap both enabled and disabled, and I am using Unity 2017.1.0f3. Thank you for your help! (And thank you again for creating STM, it's great!)

Video of STM 1.7.1 (Undesirable Behavior):

Video of STM 1.6.3 (Expected Behavior):

Developer

Hey!

Hm, this is similar to a bug that happened in 1.7 that I thought I fixed in 1.7.1, but I must not have fixed it fully. I think I fixed it for text that was done reading but never tested it for text that's in the middle of reading out. I won't be able to work on this for about 2 weeks or so, so I'm really sorry about this, I think I know exactly what's causing this though, so thank you for pointing it out!

(2 edits)

Thank you for replying! And don't worry about it at all, I downgraded back to 1.6.3 for now, so waiting a few weeks is no problem at all!

I also noticed another difference in the behavior between 1.6.3 and 1.7.1 when it comes to "Middle Center" anchored & "Left" aligned text. It's possible I misconfigured something in 1.7.1 related to the new options, so I'm not 100% sure if this is a bug or not or me just being stupid. Actually, this might even just be the same thing as the previously mentioned bug (if that's the case, sorry for making a redundant post like this), but I wasn't sure and it seemed different enough to me from the other bug that I thought it might help if I uploaded a video of it. The behavior in 1.6.3 seems more desirable, since it's closer to how Mario and Zelda work.

Video of STM 1.7.1 (Text moves around to be vertically centered as it types out):

Video of STM 1.6.3 (Vertical center is precalculated before it writes out, so text doesn't shift up and down as it types out):

Developer

Oh yikes, nice catch! Yeah the text's position is always supposed to be pre-calculated, so I'll make not of this... I'm guessing this is the result of a hotfix I did in 1.7.1. I think I have a lot of reverting to do, switching from lineCountLimit to verticalLimit is a bit tougher than I anticipated