- Home /
Question by
zak666 · Apr 26, 2015 at 08:49 PM ·
scriptingbasics
Flashing colors 'UnityEngine.Component.renderer' is obsolete.
Hi, imported my old flashing colors script however seems to be obsolete, not sure were to put the GetComponent() (with my rigidbody errors i just had to insert a var declairing ridgid body as getcomponent, however Renderer didnt work that way. JS:
#pragma strict
var colors = new Color[2];
function Update ()
{
renderer.material.color = colors[0]; yield WaitForSeconds(.5); renderer.material.color = colors[1];
}
Comment
Answer by Cherno · Apr 26, 2015 at 09:15 PM
Renderer renderer = GetComponent(Renderer);
renderer.material.color = colors[0]; yield WaitForSeconds(.5); renderer.material.color = colors[1];
Your answer
Follow this Question
Related Questions
Project Scripting - Tracking variables (General Question) 2 Answers
How Do You Parent an Object With Scripts? 1 Answer
What does the word for mean in javascript? 1 Answer
Why button is not display the window 2 Answers
Game is Paused Menu shows up 0 Answers