I would recommend using the method string.Split() with a string array.
For example in Javascript, if you had
var Sentences : String[];
var myString = "This is the first sentence. This is the second sentence.";
You could use the split method like so:
Sentences = myString.Split("."[0]);
This will split the sentences at each period (which means you'll need to add the periods later). What you get from the above is that Sentences[0] is "This is the first sentence", and Sentences[1] comes out to be "This is the second sentence"
Then instead of using an invoke to grab the next letter, you can just use the invoke to grab the next Sentence[n];
EDIT:
If you'll be using other punctuation for sentences, you would probably do this:
Sentences = myString.Split("."[0], "!"[0], "?"[0], ":"[0]);
the split method needs characters, not strings, which is why we have to add [0], which grabs the first (and only) character in the strings we're using.
EDIT 2 : Per your request, here's an example of how to change the script to show delayed sentences:
var gFont : Font;
var letterPause = 0.01;
var Story : int = 1;
var words : String = "";
var fontStyle : GUIStyle;
private var sentences : String[];
private var word;
function Start (){
if(Story == 1) {
word = "Today is a beautiful sunny day.
-I had fun with my family.
-etc.....";
}
sentences = word.Split("-"[0]);
TypeText();
}
function TypeText(){
for (var line in sentences){
words += line;
yield WaitForSeconds (letterPause);
}
}
function OnGUI() {
GUI.skin.font = gFont;
GUI.Label(Rect(250,80,1000,500),words, fontStyle);
}
This will work well if you don't plan to use any dashes "-". It's set up to split sentences at dashes you put between them, that way you can still include punctuation.
At the start of this script we're splitting up the sentences and storing it in a string array called "sentences". Then, instead of grabbing the characters of the whole string, we're cycling through each sentence that is in our "sentences" array.