Skip to content

Game.Prefabs.StreetLightData

Assembly:
Assembly-CSharp (typical for game code / mods; replace with actual assembly if different)

Namespace: Game.Prefabs

Type:
struct

Base:
IComponentData, IQueryTypeParameter

Summary:
Component data used by the ECS (DOTS) to mark/configure a street light entity. The single field m_Layer indicates which logical street-light layer the entity belongs to (type StreetLightLayer). Because it implements IComponentData it can be attached to entities and read/modified via EntityManager or inside systems; implementing IQueryTypeParameter indicates it can be used in query-related contexts (for parameterizing or filtering queries) depending on the DOTS version in use.


Fields

  • public StreetLightLayer m_Layer
    Represents the layer/category of the street light (StreetLightLayer is typically an enum or small value-type identifying layers such as ground, elevated, decorative, etc.). Read and write this field by getting/setting the component on an Entity (EntityManager.GetComponentData / SetComponentData) or access it inside an Entities.ForEach/Job when the component is requested.

Properties

  • (none)

Constructors

  • public StreetLightData()
    Default parameterless struct constructor is provided implicitly. You can construct with an object initializer, e.g. new StreetLightData { m_Layer = StreetLightLayer.Ground }.

Methods

  • (none)

Usage Example

// Example: Adding the component during conversion from a GameObject (authoring)
using Unity.Entities;
using Game.Prefabs;

public class StreetLightAuthoring : IConvertGameObjectToEntity
{
    public StreetLightLayer layer; // set in inspector

    public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    {
        dstManager.AddComponentData(entity, new StreetLightData { m_Layer = layer });
    }
}

// Example: Reading/updating the component inside a SystemBase
public partial class StreetLightSystem : SystemBase
{
    protected override void OnUpdate()
    {
        // Read and optionally modify the m_Layer field for matching entities
        Entities.ForEach((ref StreetLightData light) =>
        {
            // inspect or change light.m_Layer here
        }).ScheduleParallel();
    }
}