-
Notifications
You must be signed in to change notification settings - Fork 1
π§© LightingArea2D
The LightingArea2D component defines a 2D lighting area that can be attached to a GameObject. It allows controlling the size, position offset, opacity, and color of the lighting area, and manages a set of light sources within it.
This component is useful for 2D lighting systems, fog effects, localized illumination, and dynamic light areas that follow objects in the scene.
The LightingArea2D automatically updates its internal lighting area based on the GameObjectβs transform combined with the configured offset and size. When size or offset is changed, the component recomputes the internal lighting area. Opacity and color can be modified at any time, immediately affecting the visual representation of the lighting. Lights added to the area are drawn within the bounds of the component, allowing dynamic and localized illumination effects.
LightingArea2D()Creates a new LightingArea2D instance with default size (100, 100), full opacity, and black color.
-
Color color: The base color of the lighting area. Default is black.
void SetSize(Vector2 size)
void SetSize(float width, float height)Sets the size of the lighting area. Changes mark the component for recomputation so the internal lighting area is updated.
void SetOffset(Vector2 offset)
void SetOffset(float x, float y)Sets a relative offset for the lighting area position relative to the GameObject it is attached to.
Vector2 GetOffset()Returns the current offset of the lighting area relative to the GameObject.
void SetOpacity(float opacity)Sets the opacity of the lighting area. Value must be between 0.0f (fully transparent) and 1.0f (fully opaque). Values outside this range are ignored.
float GetOpacity()Returns the current opacity of the lighting area.