Here i attach the script used to get char in string one by one ,bt i dnt know how its s working??? kindly help using UnityEngine; using System; using System.Collections; public class AnimText : MonoBehaviour { public int currentPosition=0; public float Delay= 0.1f; // 10 characters per sec. //public string Text="hihellohwru"; public string Text=""; public int textlength; public string[] additionalLines; //char[] b = new Char[Text.Length]; void WriteText(string aText) { //guiText.text = ""; this.gameObject.GetComponent<TextMesh> ().text = " "; currentPosition = 0; Text = aText; } // Use this for initialization void Start() { //TextOk(); StartCoroutine("TestTwo"); } IEnumerator TestTwo() { print ("hi" + additionalLines); foreach (string S in additionalLines) Text +="\n"+S; while (true) { if (currentPosition < Text.Length) this.gameObject.GetComponent<TextMesh> ().text += Text [currentPosition++]; yield return new WaitForSeconds (Delay); } } }
Debug it and follow the code flow line by line. If you can't understand what is happening in specific line just refer to documentation on Unity or C#. Try that and if you're stuck you can come back with a specific question this time.
You should clean up your code if anyone is to read it: http://forum.unity3d.com/threads/using-code-tags-properly.143875/ Did you actually do the debug? I mean if you do you can see how that happens step by step literally in front of your eyes. Any particular moment you get confused about?