Is there a way to make sure the directional light for a scene is where the skybox's "sun" is? Thanks.
Answer by Adam Rademacher
Oct 06, 2010 at 04:12 AM
You'll have to do it manually by positioning the directional light where the "sun" should appear to be for the player. The good thing is that the directional light can be outside the playable area so that it always appears to be in the same place as the sun in the skybox. Turning on your sky in the scene view can help you align it properly.
Answer by mouurusai
Sep 06, 2012 at 01:27 PM
public class DirectionHelper : Editor
static void SetDirection()
Transform selected = Selection.transforms;
selected.forward = -SceneView.lastActiveSceneView.camera.transform.forward;
This worked wonderfully for me. Much easier then setting it manually like I was before.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
To help users post good questions and use the site effectively we have posted a user guide. Please check it out.
Answers and Comments
2 People are following this question.
Sun shafts from the sun
strange textures with directional light[solved]
Shader that ignores only Directional Light?
Lightmapping outdoor scene not working, no shadows
Directional Light on Terrain