Search Unity

set a light's lightmapping property?

Discussion in 'Scripting' started by zergmouse, Mar 11, 2011.

  1. zergmouse

    zergmouse

    Joined:
    Jun 30, 2010
    Posts:
    216
    How do I set a light's lightmapping property in code? I can’t seem to figure it out. I want to set lights programmatically to be baked only as opposed to "real time". I know that i could use the drop down but i have over 200 lights to setup and I want to do it via code.

    Here is what I have so far ...

    Code (csharp):
    1.             {
    2.                 go.AddComponent("Light");
    3.                 go.GetComponent<Light>().type = LightType.Point;
    4.                 go.GetComponent<Light>().range = 10;
    5.                 go.GetComponent<Light>().intensity = 0.25f;
    6.                 go.GetComponent<Light>().shadows = LightShadows.Soft;
    7.                 go.GetComponent<Light>().shadowStrength = 0.8f;
    8.                 go.GetComponent<Light>().shadowBias = 0.05f;
    9.             }
     
  2. zergmouse

    zergmouse

    Joined:
    Jun 30, 2010
    Posts:
    216
    to add to this how do I mark an object as static?