- Home /
Brightening the colour of a material that can be any colour without shaders.
So basically I have a whole bunch of solid colour spheres and cubes. The colour they are is dependent on the colour of the of the colour the player chooses when joining a game. I have tried adding Color(0.1f, 0.1f, 0.1f) to Material.color but it throws errors at me (it seems I can only set a colour not increase or decrease values. I would be using shaders for highlighted out lines and cool stuff like that but I only have Unity free, not Pro. Can someone let me know how to actually do this please? I have been searching for a while now but nothing I find is of much help at all.
Kindest regards! Scobbo
My Code:
oldColour = gameObject.renderer.material.color;
newColour = oldColour + Color(0.1f, 0.1f, 0.1f);
gameObject.renderer.material.color = newColour;
:EDIT: I meant post processing, not shaders. DERP
Answer by Eric5h5 · May 01, 2013 at 02:34 AM
You need to use shaders; for Material.color to work it requires the shader to have a "_Color" property. It's impossible for anything to be drawn without using some kind of shader, no matter how basic. Using shaders has nothing to do with Unity Pro, you know. Also Unity has a bunch of shaders built-in.
Damn it! I meant Post processing. Do you know how to add a colour to another colour? I can't get it to work.
The code you have is fine, assu$$anonymous$$g "oldColour" and "newColour" are declared as Color variables.
They are. The error I'm getting is: "Expression denotes a type', where a
variable', value' or
method group' was expected"
Of course! I always forget that with Vector3, didn't know I needed it for color. Thanks heaps!
Your answer
Follow this Question
Related Questions
My foreach or the Resources.LoadAll Is not getting the information I need 2 Answers
How do you change the tint of an entire material array for differing objects? 1 Answer
Material Instance Created in Car Model Prefab 0 Answers
Textures imported from Substance Painter have a completely different color in Unity 2 Answers
How to change material color to a specific object group's childs..? 1 Answer