- Home /
The question is answered, right answer was accepted
Having trouble with renderer.material
I know how to use renderer.material, but the problem is when i do renderer.material.color=Color.orange or light blue it doesn't work. I'm making a green lantern game and i have text under each color lantern core, but i can't get orange or indigo because it won't let me have those colors in the renderer.material.
Answer by KellyThomas · Dec 25, 2013 at 03:08 PM
Please read the documentation for Color. You will find that it only has limited support for "named" colors.
You can however use this code:
renderer.material.color = new Color(1.0f, 0.5f, 0.0f); // orange
or this:
renderer.material.color = new Color32(255, 128, 0); // orange
You may also find `HexConverter ` useful.
Follow this Question
Related Questions
Changing material Color using RBG? 3 Answers
Using Three sliders (RGB) to change the sea color 1 Answer
Make changes to Sprites/Default Material and not saving this change in prefabs. 1 Answer
ExecuteInEditMode doesn't work on instantiated list of objects? 1 Answer
HDRP has no Emission effect,HDRP Setting emission has no effect 0 Answers