Table of Contents

Class Light2D

Namespace
Godot
Assembly
GodotSharp.dll

Casts light in a 2D environment. A light is defined as a color, an energy value, a mode (see constants), and various other parameters (range and shadows-related).

public class Light2D : Node2D, IDisposable
Inheritance
Light2D
Implements
Derived
Inherited Members

Properties

BlendMode

The Light2D's blend mode. See Light2D.BlendModeEnum constants for values.

public Light2D.BlendModeEnum BlendMode { get; set; }

Property Value

Light2D.BlendModeEnum

Color

The Light2D's Color.

public Color Color { get; set; }

Property Value

Color

EditorOnly

If true, Light2D will only appear when editing the scene.

public bool EditorOnly { get; set; }

Property Value

bool

Enabled

If true, Light2D will emit light.

public bool Enabled { get; set; }

Property Value

bool

Energy

The Light2D's energy value. The larger the value, the stronger the light.

public float Energy { get; set; }

Property Value

float

RangeItemCullMask

The layer mask. Only objects with a matching LightMask will be affected by the Light2D. See also ShadowItemCullMask, which affects which objects can cast shadows.

Note: RangeItemCullMask is ignored by DirectionalLight2D, which will always light a 2D node regardless of the 2D node's LightMask.

public int RangeItemCullMask { get; set; }

Property Value

int

RangeLayerMax

Maximum layer value of objects that are affected by the Light2D.

public int RangeLayerMax { get; set; }

Property Value

int

RangeLayerMin

Minimum layer value of objects that are affected by the Light2D.

public int RangeLayerMin { get; set; }

Property Value

int

RangeZMax

Maximum z value of objects that are affected by the Light2D.

public int RangeZMax { get; set; }

Property Value

int

RangeZMin

Minimum z value of objects that are affected by the Light2D.

public int RangeZMin { get; set; }

Property Value

int

ShadowColor

Color of shadows cast by the Light2D.

public Color ShadowColor { get; set; }

Property Value

Color

ShadowEnabled

If true, the Light2D will cast shadows.

public bool ShadowEnabled { get; set; }

Property Value

bool

ShadowFilter

Shadow filter type. See Light2D.ShadowFilterEnum for possible values.

public Light2D.ShadowFilterEnum ShadowFilter { get; set; }

Property Value

Light2D.ShadowFilterEnum

ShadowFilterSmooth

Smoothing value for shadows. Higher values will result in softer shadows, at the cost of visible streaks that can appear in shadow rendering. ShadowFilterSmooth only has an effect if ShadowFilter is Pcf5 or Pcf13.

public float ShadowFilterSmooth { get; set; }

Property Value

float

ShadowItemCullMask

The shadow mask. Used with LightOccluder2D to cast shadows. Only occluders with a matching LightMask will cast shadows. See also RangeItemCullMask, which affects which objects can receive the light.

public int ShadowItemCullMask { get; set; }

Property Value

int

Methods

GetHeight()

Returns the light's height, which is used in 2D normal mapping. See Height and Height.

public float GetHeight()

Returns

float

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

SetHeight(float)

Sets the light's height, which is used in 2D normal mapping. See Height and Height.

public void SetHeight(float height)

Parameters

height float