2
\$\begingroup\$

A bit of a unity beginner here. I have a windmill prefab and I would just like to add a simple point or directional light to my prefab. I added the component for a light to the prefab and started the game, but it seems like no matter what I try, the light would not appear. I tried to move the component to the top in the Inspector window (thinking another component would overwrite the light properties).

Any ideas? Or things Im doing wrong?

\$\endgroup\$
1
  • \$\begingroup\$ Are you able to provide a screenshot of your prefab with the light added to it? Are you able to select the light in your prefab and tweak it? Another thing to consider is default lighting, maybe try turning that off? see docs.unity3d.com/Manual/class-RenderSettings.html for details (ambient light) \$\endgroup\$ Jan 8, 2015 at 3:47

2 Answers 2

4
\$\begingroup\$

For the purpose of this answer I will assume that your windmill is a 3D model, and that you meant spotlight rather than directional light.

There are numerous reasons as to why you might no see light being projected from your windmill prefab, I'll list what I can think of here (and edit with additions if I think of more).

  • The light's range or intensity are too low to reach nearby meshes and create a visible effect.
  • The light is disabled (will appear greyed-out in Hierarchy).
  • The light's render mode is set to not important.
  • The light's culling mask doesn't include the correct layers for projecting light onto the environment.
  • The light's culling mask incorrectly includes the windmill's layer when it should be ignored.
  • The light uses the prefab's position as a point of origin and this position is within the model; the light has a shadow type other than no shadows; your windmill prefab has mesh-faces that are turned inward towards the light's point of origin (think inner walls, etc); the model has cast shadows enabled; nearby meshes that you expect to receive the light have receive shadows enabled. The result being that the windmill model is blocking the light by casting shadows on anything that the light might reach. The interior of the windmill will be lit-up if this is the case.

Also note that lighting effects of this nature are visible in the game window without running the game, and component order should have no impact on your light.

\$\endgroup\$
0
\$\begingroup\$

Did you want a light shining on the windmill (from outside), or a light emanating from the windmill?

If you meant the first, then instead of putting a light component on the existing windmill's GameObject, you simply want to create a new GameObject, a bit outside the windmill, on which to place the light component.

(You can parent that new light GameObject to the windmill to make it part of the prefab if you like.)

\$\endgroup\$
1
  • \$\begingroup\$ Frankly, in either case I would recommend making the light a separate object from the windmill, rather than a component. \$\endgroup\$
    – jhocking
    Mar 11, 2015 at 12:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .