Game.Prefabs.LightEffectData
Assembly:
Namespace: Game.Prefabs
Type: struct
Base: IComponentData, IQueryTypeParameter
Summary:
LightEffectData is a DOTS component used by prefab light effects. It contains parameters that control light falloff, level-of-detail thresholds and color temperature used by the game's light-effect rendering systems. This component is intended to be attached to light-related entities (prefab instances) so systems can read and apply visual light properties.
Fields
-
public float m_Range
Controls the effective radius (range) of the light effect. Interpreted in world units (meters). Larger values increase how far the effect reaches. Typical values depend on light type (e.g., small lamps vs. streetlights). -
public float m_DistanceFactor
A multiplier used in distance-based attenuation calculations. Higher values cause the light intensity to fall off differently across distance. Exact usage depends on the effect shader/system. -
public float m_InvDistanceFactor
The inverse of m_DistanceFactor (often 1 / m_DistanceFactor). Stored to avoid repeated division in hot code paths. When setting m_DistanceFactor at runtime, ensure m_InvDistanceFactor is updated accordingly (or set both consistently). -
public int m_MinLod
Minimum level-of-detail (LOD) index at which this light effect should be considered/rendered. Higher values mean the effect may be skipped until a higher-detail LOD is active. Use this to reduce cost for distant instances. -
public float m_ColorTemperature
Color temperature controlling the light color. Represented as a scalar value (commonly Kelvin-like values such as ~2700 for warm light, ~6500 for neutral/daylight). The exact mapping to color depends on the rendering system that consumes this value.
Properties
- None
Constructors
public LightEffectData()
Structs have a default parameterless constructor. Initialize fields explicitly when creating a new instance to ensure sensible defaults.
Methods
- None
Usage Example
// Create and attach LightEffectData to an entity using the EntityManager
var lightEffect = new Game.Prefabs.LightEffectData
{
m_Range = 12f,
m_DistanceFactor = 1.5f,
m_InvDistanceFactor = 1.0f / 1.5f,
m_MinLod = 0,
m_ColorTemperature = 3000f // warm light
};
entityManager.AddComponentData(entity, lightEffect);
// If you update m_DistanceFactor at runtime, also update m_InvDistanceFactor:
lightEffect.m_DistanceFactor = 2f;
lightEffect.m_InvDistanceFactor = (lightEffect.m_DistanceFactor != 0f) ? 1f / lightEffect.m_DistanceFactor : 0f;
entityManager.SetComponentData(entity, lightEffect);
Notes and modding tips: - When authoring prefab defaults, set both m_DistanceFactor and m_InvDistanceFactor consistently. - Changing component data at runtime may require the consuming systems to re-read or the chunk to be marked changed before visuals update. - For color tweaking, experiment with typical Kelvin ranges (e.g., 2700–6500) and verify how the game maps temperature to RGB in your environment.