Changing tint color of skybox via script

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!

This is how the tint color is declared in the skybox shader :

Properties {
    _Tint ("Tint Color", Color) = (.5, .5, .5, .5)
    // other stuff
}

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)

skyBoxName.SetColor( "_Tint", Color( 0.0, 30.0 / 255.0, 0.0, 1.0 ) );

skyBoxName.color = Color( red, green, blue )

You can’t directly set the r,g,b values, they’re just for reading.