Hello,
I have a problem after I make a GUIText script which it’s works. But today
I work on another scene in the same project as these code and after I just
create a new script in C# and named it “GuiText” and after that I didnt do
anything to this script and then the script here got the error.
Assets/Game 1 - Catch eggs/Scripts/GameGuiText.cs(21,30): error CS1061: Type
GUIText' does not contain a definition for
text’ and no extension methodtext' of type
GUIText’ could be found (are you missing a using directive or an assembly reference?)Assets/Game 1 - Catch eggs/Scripts/GameGuiText.cs(22,33): error CS1061: Type
GUIText' does not contain a definition for
text’ and no extension methodtext' of type
GUIText’ could be found (are you missing a using directive or an assembly reference?)Assets/Game 1 - Catch eggs/Scripts/GameGuiText.cs(23,31): error CS1061: Type
GUIText' does not contain a definition for
text’ and no extension methodtext' of type
GUIText’ could be found (are you missing a using directive or an assembly reference?)Assets/Game 1 - Catch eggs/Scripts/GameGuiText.cs(41,38): error CS1061: Type
GUIText' does not contain a definition for
text’ and no extension methodtext' of type
GUIText’ could be found (are you missing a using directive or an assembly reference?)
using UnityEngine;
using System.Collections;
public class GameGuiText : MonoBehaviour {
public SpawnerScript Spawner;
public static int theScore;
public static bool gameOver;
public GUIText gameOverText;
public GUIText gameRestartText;
public GUIText gameScoreText;
public int timeToWait;
void Start()
{
theScore = 0;
gameOver = false;
gameOverText.text = "";
gameRestartText.text = "";
gameScoreText.text = "Score: " + theScore;
}
void Update()
{
Time.timeScale = 1.0f;
ScoreUpdate ();
GameOver ();
}
void SetGameOver()
{
gameOver = true;
}
void GameOver()
{
if (gameOver == true) {
gameOverText.text = "Game Over!";
Spawner.enabled = false;
StartCoroutine (WaitTime());
}
}
void ScoreUpdate()
{
// gameScoreText.text = "Score: " + theScore;
}
IEnumerator WaitTime()
{
yield return new WaitForSeconds(3);
Time.timeScale = 0;
// gameRestartText.text = "Press 'R' to Restart";
if(Input.GetKeyDown(KeyCode.R))
{
Application.LoadLevel(Application.loadedLevel);
}
}
}
I not save the project and reload it before these things happen but the error
remain. For the other project that use similar code to these code is still work
but in this project I cant use the “.text” and cant drag the GuiTextObject in to
the inspector to use in the script.
Thank for help and answers
Best Regards.