How can I create a subtitle like that ?

Hi,
If you seen before in lots of game subtitle doesn’t shows at once and it writing words one after one
I really haven’t any idea how can I do such a thing like that
Please help thanks

The concept of subtitles revolves around a timing mechanism that shows when to display certain pieces of text. What you are asking for is just like this. You need a timer that will display peices of text, at certain points. If you are trying to time words, expect to do more work.

This is a simple example of a couple of lines that would display. At 6.1, the first one would come up. At 8.3 the second.

6.1~This is some text I wanted to see.
8.3~This is some more text I want to see.

Thanks a lot, Then you’re saying I should make lots of GUI that each of them contains one word ?
For example I would to write My name is Tom
So I should Create 11 GUI and put them near each others and then show them one after one ?

Isn’t there any better way?
thanks

heh, not really, it is more like a method of writing a “script”

Every line says. Display this at this time.

Read it all into 1 string, use Split(“\n”[0]) to split the lines, then use Split(“~”[0]) to split the line into the number and text. Use the number to offset the animation or start time and set the text to a GUIText box.

All you then have to do is figure out which one is supposed to be where. Do that in the Update and you got it.

Thanks a lot, I think I know how it works now
But just I don’t understand why when I use (yield WaitForSeconds (1)) Text doesn’t show up at all
I don’t know anything about Timer and I would to use “yield WaitForSeconds” instead but it doesn’t work

Naw, you want to use (Time.time - PlayStartTime) to define where you are in your current time frame. From there, you can simply roll through the text and figure out which is oldest without going over. This is all done in the Update, not a coroutine.

Sorry I’m a little noob at JS, More than a little
What is “Time.time - PlayStartTime” ?
I don’t know how to use it :mrgreen:

Time.time is the current time since the game started running. But you’re not showing your text at the very beginning of the game, so you need to subtract the time you actually started showing text - which you’d save in a variable, such as PlayStartTime, when the “Show Message” function was called. Then if Time.time - PlayStartTime = 5.5, you know that 5.5 seconds has passed since you started showing the message.

As for writing the words one after another, there are three ways:

  1. Easy Way - Use String.Split to separate your text into words. Show a word every X seconds.
  2. Harder Way - Modify the spacing between words based on the word length (or more accurately, a dictionary), and the punctuation. The simplest version of this is simply to add extra time after any punctuation, which should improve the look somewhat.
  3. Slow Way - If you have audio, and you want the word timing to actually match it, you’ll have to mark down that data somewhere - probably in the file you’re reading the text from. Not sure if there’s any automatic way to do this.

As an alternative to “showing”, wouldn’t it be easier to just concatenate the next word?

Thanks guys, I just have one more problem
I’ve created a GUI Text and attached it to main camera and everything looks good but when I change the camera position I can’t see text anymore

Anybody knows what’s the problem?

show us your code, I think we would be more inclined to be able to answer your question once we see how your going about this