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
Color
The Light2D's Color.
public Color Color { get; set; }
Property Value
EditorOnly
If true
, Light2D will only appear when editing the scene.
public bool EditorOnly { get; set; }
Property Value
Enabled
If true
, Light2D will emit light.
public bool Enabled { get; set; }
Property Value
Energy
The Light2D's energy value. The larger the value, the stronger the light.
public float Energy { get; set; }
Property Value
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
RangeLayerMax
Maximum layer value of objects that are affected by the Light2D.
public int RangeLayerMax { get; set; }
Property Value
RangeLayerMin
Minimum layer value of objects that are affected by the Light2D.
public int RangeLayerMin { get; set; }
Property Value
RangeZMax
Maximum z
value of objects that are affected by the Light2D.
public int RangeZMax { get; set; }
Property Value
RangeZMin
Minimum z
value of objects that are affected by the Light2D.
public int RangeZMin { get; set; }
Property Value
ShadowColor
Color of shadows cast by the Light2D.
public Color ShadowColor { get; set; }
Property Value
ShadowEnabled
If true
, the Light2D will cast shadows.
public bool ShadowEnabled { get; set; }
Property Value
ShadowFilter
Shadow filter type. See Light2D.ShadowFilterEnum for possible values.
public Light2D.ShadowFilterEnum ShadowFilter { get; set; }
Property Value
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
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
Methods
GetHeight()
public float GetHeight()
Returns
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_nameName of the method to check for.
Returns
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_nameName of the signal to check for.
Returns
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_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
SetHeight(float)
public void SetHeight(float height)
Parameters
height
float