Add Light Source to Sun in Environmental Lighting with Unity 5 by Script?

I’ve checked all the API with Unity 5, and unless I’m missing something, I can’t seem to find out how to add a light source to the Skybox Sun under the Lighting part of Unity.

Is there another way to go about this? How could I achieve this if there is no way to access it?

I would like to choose, by script and on start, what light source to add according to the light source added in the editor.

RenderSettings doesn’t contain any sun related words. I have tried everything, unless it’s accessed somewhere else.

If it’s not possible, why would Unity not make this visible? It seems like something someone might want to have access to.

Any info would be greatly appreciated.

This is what I did since it automaps to the brightest light so that it wouldn’t break my day/night cycle.

  1. Parented another directional light under my sun light and called it “DummyEnvironmentLight”.
  2. Zeroed out Position and Rotation values so it will always be oriented exactly the same as my sun light.
  3. Cranked up the intensity to 8.
  4. Set the culling mask to Nothing.

Unity picks it up as the sun even though it will never affect anything. It also works in a prefab.

Hope this helps somebody :slight_smile:

Guys if you vote here we might be able to get this in 5.4.x! https://feedback.unity3d.com/suggestions/option-to-set-sun-light-via-script