Search Unity

Point Light Problem

Discussion in 'Editor & General Support' started by MegadethRocks, Mar 19, 2010.

  1. MegadethRocks

    MegadethRocks

    Joined:
    Dec 12, 2009
    Posts:
    162
    My point lights aren't working properly and I can't seem to find the problem. When I am playing in the editor all of my point lights break when I get a certain distance away from the light, although I'm still within range of the light. They go from lighting the player object normally to not lighting the player at all. This happens with all of my points lights, but only in a few scenes. The other scenes all seem to work just fine. In the editor I can fix the problem by clicking on anything in the Hierarchy or Scene view, but in a build there is nothing I can do to fix it.

    Here is a picture from the editor right after the light turns off.



    Here is the same view of the game right after I click on something in the Scene view.



    This problem affects all of the points lights in the scene and when I click in the Scene view it fixes the problem for all of the point lights at once. I have no idea what the problem could be. The lights are instantiated through a script, but I have lights in working scenes instantiated the same way. Just in case it matters, here is the code for setting up the light after I have created it.

    Code (csharp):
    1.  
    2. protected static void SetupLight(Light light)
    3.     {
    4.         light.type = LightType.Point;
    5.         light.color = new Color(1, 1, 1, 1);
    6.         light.attenuate = true;
    7.         light.range = 30;
    8.         light.renderMode = LightRenderMode.ForceVertex;
    9.         light.cullingMask = 0x01 << 8;
    10.         light.intensity = 1;
    11.     }
    12.  
     
  2. Discord

    Discord

    Joined:
    Mar 19, 2009
    Posts:
    1,008
    If you have more than a couple lights in your scene, you could try increasing the maximum number of lights in the quality settings. Idk if that is the problem but it's worth a try.
     
  3. MegadethRocks

    MegadethRocks

    Joined:
    Dec 12, 2009
    Posts:
    162
    All of my lights are Vertex lights. I think the quality settings only apply to Pixel lights.
     
  4. MegadethRocks

    MegadethRocks

    Joined:
    Dec 12, 2009
    Posts:
    162