access skybox material properties via script

Hi,
I’d like to access the skybox tint color via script.

I tried (with script attached to the camera)

camera.GetComponent(Skybox).material.color=Color.black;

but I’m getting a NullreferenceException :confused:

any ideas?

the ‘skybox’ property of RenderSettings is a material, thus…

RenderSettings.skybox = skyBoxMaterial;

I think it’s:

RenderSettings.skybox.material

For Unity 2019.3.5

In Awake RenderSettings.skybox is null even if it is set in the scene.
I thought this was strange so wanted to share

		private void Awake()
		{
			Assert.IsNull(RenderSettings.skybox);
		}

		private void Start()
		{
			Assert.IsNotNull(RenderSettings.skybox);
		}

And what if you create a variable and drag the skybox material in there.
You can then access the variable from script.

var MyMat: Material;