- Home /
Question by
FatalNightmare · Jan 09, 2013 at 04:41 AM ·
javascriptguirandomlight
Help with GuiText flickering code.
Hello, I am trying to have my 3D Text in my game flicker. I have a script that has my lights flicker and I tried modifying it to fit the 3DText and it keeps coming up with the error: "NullReferenceException: Object reference not set to an instance of an object" Here is my code
var GuiText1 : GameObject;
function Update ()
{
if ( Random.value > 0.9 ) //a random chance
{
if ( GuiText1.Renderer.enabled == true ) //if the light is on...
{
GuiText1.Renderer.enabled = false; //turn it off
}
else
{
GuiText1.Renderer.enabled = true; //turn it on
}
}
}
Comment
I assigned GUIText1 a 3Dtext, don't know why it's named GuiText haha.
Best Answer
Answer by Eric5h5 · Jan 09, 2013 at 05:30 AM
It's "renderer", not "Renderer". Variables are never uppercase.
Your answer
Follow this Question
Related Questions
Setting Scroll View Width GUILayout 1 Answer
Random number that doesn't repeat. (javascript) 3 Answers
Is it possible to link character skill lists to a GUI, and if so, how? 3 Answers
Move the text in a GUI Button/Box 1 Answer
Gui Text Script 4 Answers