- Home /
Question by
paco morales · Jun 08, 2013 at 12:24 AM ·
countdownupdating
Updating a MeshText as a child?
Hello Everyone,
I'm trying to active or updating a MeshText as a child of a Sphere and I want to active it from the Sphere's script.
I'm using the function "GetComponentInChildren", but I can't make to change the text. Only the first line shows "myTextMesh.text = "1";" the number 1.
I want to make a countdown using the InvokeRepeting function.
The console shows this message "The referenced script on this Behaviour is missing!"
Here you can see my script, please any help is more than welcome!
function Start()
{
InvokeRepeating("CountDown",0,3);
}
function CountDown()
{
if(renderer.enabled)
{
var myTextMesh = (GetComponentInChildren(TextMesh) as TextMesh);
var text : String;
myTextMesh.text = "1";
yield WaitForSeconds(1.0);
myTextMesh.text = "2";
yield WaitForSeconds(1.0);
myTextMesh.text = "3";
yield WaitForSeconds(1.0);
}
}
Comment
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Problem with player updating. 0 Answers
How to stop a timer with GUI button? 1 Answer
how to make a countdown of destroyed objects ? 1 Answer
CountDown Camera problem 0 Answers