hi guys i want to destroy GUI object
heres what i have done
using UnityEngine;
using System.Collections;
public class PowerUpScript : MonoBehaviour {
int random = 0;
float timer = 3;
// Use this for initialization
void Start () {
}
void Update()
{
if (timer >= 1 && random == 1) {
guiText.text = timer.ToString ("something");
} else if (timer >= 1 && random == 0) { // timer is <= 0
guiText.text = timer.ToString ("otherThing");
} //else
//Destroy (??);
}
void OnTriggerEnter (Collider other)
{
random = 0;
PadleScript paddleScript = GameObject.Find ("paddle").GetComponent<PadleScript>();
if(random==0)
paddleScript.AddPoints (50);
if (random == 1)
{
paddleScript.spawnball ();
}
Destroy (gameObject);
}
}
p.s im also getting a weird warning :
“MissingComponentException: There is no ‘GUIText’ attached to the “powerUp” game object, but a script is trying to access it.
You probably need to add a GUIText to the game object “powerUp”. Or your script needs to check if the component is attached before using it.
PowerUpScript.Update () (at Assets/Scripts/PowerUpScript.cs:19)”
thanks