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 ().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 ().text += Text [currentPosition++];
yield return new WaitForSeconds (Delay);
}
}
}
Pirs01
August 20, 2014, 2:05pm
3
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.
k ,just to know when WriteText() is called?
hi,thanks for ur reply.i want to know hw the text is inserted to add[ ] string array?
Pirs01
August 21, 2014, 9:23am
6
You should clean up your code if anyone is to read it: Using code tags properly - Unity Engine - Unity Discussions
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?
ya i do it,just to know how foreachloop(String s in String)?
Pirs01
August 21, 2014, 9:58am
8
Google is your friend, you know that right?
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.