|
I'm trying to access and change the tint color of my skybox via my script. I've read some other questions on unity answers on this but unfortienly they didn't help me at all. I'm trying to reach the RGB via the script. Can anyone give me a few or atleast one detailed example of how to do this. This is what i tried... skyBoxName.color.g = 30; But i got "Cannot modify a value type return value of `UnityEngine.Material.color" error Thanks for reading!
(comments are locked)
|
|
This is how the tint color is declared in the skybox shader : Unfortunately, material.color is a property declared like that in Unity (because _Color is usually the name you give to the main color) : This, with the fact that you can only assign a complete color to the property and not modify r,g,b, or alone, is why your code isn't working. Finally, Color's values are between 0 and 1, not 0 and 255. Here is the solution : (js) Thank you so much! Think you can translate it to C#? I'm not that experienced as you can see yourself.
Jun 25 '12 at 06:43 PM
SimonTheDiamond
Come on, one line isn't so hard ;) You need to add a 'new' somewhere and 5 'f'.
Jun 25 '12 at 06:59 PM
Berenger
I solved it, haha! Thank you so much!
Jun 25 '12 at 07:42 PM
SimonTheDiamond
Thanks for that answer!
Jul 23 '12 at 09:30 AM
zerebruin
(comments are locked)
|
|
skyBoxName.color = Color( red, green, blue ) You can't directly set the r,g,b values, they're just for reading.
(comments are locked)
|
