Changing the Typewritter Effect's Speed Mid Sentence
Posted: Thu Apr 28, 2016 9:39 am
First, I just wanted to express how much I appreciate everything you guys have done for us. It's seldom that I see both quick and effective technical support, so thank you!
I was working on creating more lively conversations in my game. Because there's no voice acting, I'm going to have various effects on the displayed subtitle text in order to express the character's emotions. I am using a slightly modified version of the UnityUITypewriterEffect script that came with the system, and I wanted to simulate natural conversational flow by altering the charactersPerSecond field while the characters are talking. For example, I was going to emulate a short mid-sentence pause in speech by setting the charactersPerSecond to zero after a certain point in the sentence, and then set it back to its default value after a certain amount of time. I would do this in a custom C# function that's been placed in the Lua environment.
However, when I tested this out, it did not work. Looking at the script, it looks like it's because the charactersPerSecond field is used to calculate the speed only once at the start of the Play() function. Because of this, changing the field mid-play would not have any effect. In addition, the function appears to reject nonpositive charactersPerSecond values, so I would not be able to do the above example (though, setting it to a very small positive value seems like a possible workaround).
Is there any other way I can get the effect I'm looking for? Editing the code to get the desired effect seems somewhat non-trivial from what I can tell, and I don't want to make any huge edits without a deep understanding of the system. I suppose I could automatically call OnContinue after a certain amount of time, but I don't want the text box to erase itself after doing so.
Thanks for your time!
I was working on creating more lively conversations in my game. Because there's no voice acting, I'm going to have various effects on the displayed subtitle text in order to express the character's emotions. I am using a slightly modified version of the UnityUITypewriterEffect script that came with the system, and I wanted to simulate natural conversational flow by altering the charactersPerSecond field while the characters are talking. For example, I was going to emulate a short mid-sentence pause in speech by setting the charactersPerSecond to zero after a certain point in the sentence, and then set it back to its default value after a certain amount of time. I would do this in a custom C# function that's been placed in the Lua environment.
However, when I tested this out, it did not work. Looking at the script, it looks like it's because the charactersPerSecond field is used to calculate the speed only once at the start of the Play() function. Because of this, changing the field mid-play would not have any effect. In addition, the function appears to reject nonpositive charactersPerSecond values, so I would not be able to do the above example (though, setting it to a very small positive value seems like a possible workaround).
Is there any other way I can get the effect I'm looking for? Editing the code to get the desired effect seems somewhat non-trivial from what I can tell, and I don't want to make any huge edits without a deep understanding of the system. I suppose I could automatically call OnContinue after a certain amount of time, but I don't want the text box to erase itself after doing so.
Thanks for your time!