- Home /
Javascript for changing color of an object?
I was wondering if you used RGB Numbers or just the word. Examples?
Answer by Jessy · Jan 21, 2011 at 05:26 AM
You're probably referring to the example docs which use the shortcuts, like Color.red or Color.green. That's all they are shortcuts. See this page for what they actually mean.
Answer by FLASHDENMARK · Jan 21, 2011 at 06:14 AM
There are some:
renderer.material.color = Color.red;
renderer.material.color = Color.white;
renderer.material.color = Color.black;
renderer.material.color = Color.blue;
renderer.material.color = Color.green;
renderer.material.color = Color.yellow;
I do not recall if there are anymore, but there are some atleast.
Just put them in a empty script if you want, no need for any functions.
Your answer seems to be slightly distorted. Correct it, and then I'll reward you.
Your answer
![](https://koobas.hobune.stream/wayback/20220613100413im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
JS to C# List type problem 1 Answer
How to add realistic materials from blender to Unity 2 Answers
How to pick / drop object 1 Answer
How I can create a Javascript object in a unity Script? 1 Answer
Move object back automatically 1 Answer