I trying to get the text to show and disappear in my scene . When I have save the script I have gotten five of the same errors .
(18,13): error CS0103: The name timeShown' does not exist in the current context (16,6): error CS0103: The name
canvasGroup’ does not exist in the current context
(17,6): error CS0103: The name textElement' does not exist in the current context (23,6): error CS0103: The name
canvasGroup’ does not exist in the current context
(24,6): error CS0103: The name `textElement’ does not exist in the current context
Here is my script :
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class fly : MonoBehaviour {
public Game
void ShowMessage(string message, float timeToShow = 10)
{
StartCoroutine(ShowMessageCoroutine(message, timeToShow));
}
IEnumerator ShowMessageCoroutine(string message, float timeToShow = 10)
{
canvasGroup.alpha = 1;
textElement.text = message;
while (timeShown < timeToShow)
{
timeShown += Time.deltaTime;
yield return null;
}
canvasGroup.alpha = 0;
textElement.text = "The points require for this level is 2500";
}
}