Guest User

Untitled

a guest
Oct 16th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. public class WelcomeTextController : MonoBehaviour
  2. {
  3. public Text text;
  4. public float typingDuration;
  5.  
  6. [TextArea(10, 10)]
  7. public string welcomeText;
  8.  
  9. void Start()
  10. {
  11. new Interpolation(t => SetString(str, ratio))
  12. .Duration(typingDuration)
  13. .Build(this)
  14. .Play();
  15. }
  16.  
  17. void SetString(string str, float ratio)
  18. {
  19. this.text.text = str.Substring(0, (int) (ratio * str.Length)));
  20. }
  21. }
Add Comment
Please, Sign In to add comment