Hi,
I have encountered a problem.
While making the text randomly generated lines out in, but it does not go away after a new line come out and it overlap the lines. Like the picture I post.

I am trying not to use OnGUI because it change its position on different platform.
// So I make use of ConditionUI to use the TextMash. the problem here is that the message doesn’t disappear and the new message are being overlap so it looks like a mess.
if(showText = true)
{
MakeText(message,new Vector2(0,0.06f),30,Color.black);
}
or need to use MakeText(“”,newVector2(0,0.06f),30,Color.black); to put somewhere?
or any of your help. Thank you.
^//
So, I’m wondering if anybody can help me solve it by stopping the overlap and change by itself when generating?
Here is my script, in C#.
using UnityEngine;
using System.Collections;
using System.ComponentModel;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using MadLevelManager;
public class RandomTipScript : ConditionUI
{
//public GUISkin GameSkin;
private bool showText = false, someRandomCondition = true;
private float currentTime = 100.0f, executedTime = 10.0f, timeToWait = 100.0f;
string[] messages;
string message ;
TextMesh _text = null;
void Start()
{
messages = new string[]{"Online Scam:\nBe Wary of Cheap Deals\nthat seem too good to be true!",
"Online Scam:\nReview the seller's reputation\nbefore making any purchases!",
"Online Scam:\nDo Not Share Your Credit Card\ndetails on unsecured websites!",
"Merry Christmas",
"You are cool!"};
message = messages [0];
}
void OnMouseDown()
{
executedTime = Time.time;
}
void Update()
{
currentTime = Time.time;
if (someRandomCondition)
{
showText = true;
Random rnd = new Random ();
int i = Random.Range (0, messages.Length + 1);
message = messages [i];
timeToWait = 100.0f;
if(showText = true)
{
MakeText(message,new Vector2(0,0.06f),30,Color.black);
}
}
if (timeToWait > 0)
{
timeToWait --;
someRandomCondition = false;
}
else
{
someRandomCondition = true;
}
}
}