Guys, I want to ask a question. How could I make a chat background similar like this link?
[Link][1]
With the auto text (the text will automatically typed one by one words per time).
The thing is, I already done the chat background similar to the image above, but with the transparent background, when I tried to fill the transparent background with the text in it, the text did not show.
Here is the image when it is on transparent background:
![alt text][2]
And here is the code that I have been using for this one (auto text):
using UnityEngine;
using System.Collections;
public class AutoText : MonoBehaviour
{
public float letterPause = 0.5f; // Define and set the pause for each letters
public AudioClip sound = null; // For the sound
public static string message = "Help...! Help...!" + "\n" + "Somebody...! Please Help Me...!"; // The message
private void Start()
{
StartCoroutine(TypedText());
}
IEnumerator TypedText()
{
// Loop through the message
foreach (char letter in message.ToCharArray())
{
// Set the gui text to be same with message
guiText.text += letter;
// If sound available
if (sound)
{
// Play it on each words
audio.PlayOneShot(sound);
// Go back to the if statement
yield return 0;
}
// Each letters will be shown for how many seconds delay
yield return new WaitForSeconds(letterPause);
}
}
}
For the text itself, I create a gui text in the unity editor and put the script on it, like the below image:
![alt text][3]
Could anyone help me?
Thank you
[1]: https://i.ytimg.com/vi/VzBY5vPvGws/mqdefault.jpg
[2]: /storage/temp/35805-text+scene.png
[3]: /storage/temp/35808-auto+text.png
↧