Hi, I’ve already made a question about this problem but it was kinda different, now I have an idea how I can possible make it. I have this intro sequence, but sometimes the character gets instantiated earlier and some times too late, (https://dl.dropboxusercontent.com/u/151460612/webplayer/webplayer.html), so I think how I can make it now, this is my text script:
using UnityEngine;
using System.Collections;
public class TextScript : MonoBehaviour
{
public float letterPause = 0.05f;
public GUIStyle font;
string message;
string text;
void Start () {
message = "using UnityEngine;
using System.Collections;
public class BadassScript : MonoBehaviour {
public GameObject CROS;
void Start () {
GameObject CROSClone = (GameObject) Instantiate
(CROS, new Vector3 (0f, 0f, 0f), Quaternion.identity);
CROSClone.AddComponent<Rigidbody>();
}
void Update () {
DestroySpambots ();
}
void DestroySpambots () { }";
text = "";
StartCoroutine(TypeText());
}
IEnumerator TypeText () {
foreach (char letter in message.ToCharArray()) {
text += letter;
yield return 0;
yield return new WaitForSeconds (letterPause);
}
}
void OnGUI() {
GUI.Label(new Rect(0, 0, 256, 1024), text, font);
}
void Update() {
}
}
so the best way to instantiate it always at the same time would probably be, when a certain letter is wrote, I will instantiate it, but how can I make like if char letter in message.ToCharArray = (let’s say) 50 {do stuff}?
Thanks in advance