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
Unfortunately, material.color is a property declared like that in Unity (because _Color is usually the name you give to the main color) :
public Color color{
get{ return GetColor( "_Color" );
set{ SetColor( "_Color", value );
}
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)