Struct Light2D

Casts light in a 2D environment.

struct Light2D ;

Light is defined by a (usually grayscale) texture, a color, an energy value, a mode (see constants), and various other parameters (range and shadows-related). Note: Light2D can also be used as a mask.

Properties

NameTypeDescription
color[get, set] ColorThe Light2D's Color.
editorOnly[get, set] boolIf true, Light2D will only appear when editing the scene.
enabled[get, set] boolIf true, Light2D will emit light.
energy[get, set] doubleThe Light2D's energy value. The larger the value, the stronger the light.
mode[get, set] Light2D.ModeThe Light2D's mode. See mode constants for values.
offset[get, set] Vector2The offset of the Light2D's texture.
rangeHeight[get, set] doubleThe height of the Light2D. Used with 2D normal mapping.
rangeItemCullMask[get, set] longThe layer mask. Only objects with a matching mask will be affected by the Light2D.
rangeLayerMax[get, set] longMaximum layer value of objects that are affected by the Light2D.
rangeLayerMin[get, set] longMinimum layer value of objects that are affected by the Light2D.
rangeZMax[get, set] longMaximum z value of objects that are affected by the Light2D.
rangeZMin[get, set] longMinimum z value of objects that are affected by the Light2D.
shadowBufferSize[get, set] longShadow buffer size.
shadowColor[get, set] ColorColor of shadows cast by the Light2D.
shadowEnabled[get, set] boolIf true, the Light2D will cast shadows.
shadowFilter[get, set] Light2D.ShadowFilterShadow filter type. See shadowfilter for possible values.
shadowFilterSmooth[get, set] doubleSmoothing value for shadows.
shadowGradientLength[get, set] doubleSmooth shadow gradient length.
shadowItemCullMask[get, set] longThe shadow mask. Used with LightOccluder2D to cast shadows. Only occluders with a matching light mask will cast shadows.
texture[get, set] TextureTexture used for the Light2D's appearance.
textureScale[get, set] doubleThe texture's scale factor.

Methods

NameDescription
getColor
getEnergy
getHeight
getItemCullMask
getItemShadowCullMask
getLayerRangeMax
getLayerRangeMin
getMode
getShadowBufferSize
getShadowColor
getShadowFilter
getShadowGradientLength
getShadowSmooth
getTexture
getTextureOffset
getTextureScale
getZRangeMax
getZRangeMin
isEditorOnly
isEnabled
isShadowEnabled
setColor
setEditorOnly
setEnabled
setEnergy
setHeight
setItemCullMask
setItemShadowCullMask
setLayerRangeMax
setLayerRangeMin
setMode
setShadowBufferSize
setShadowColor
setShadowEnabled
setShadowFilter
setShadowGradientLength
setShadowSmooth
setTexture
setTextureOffset
setTextureScale
setZRangeMax
setZRangeMin

Enums

NameDescription
Constants
Mode
ShadowFilter