Skip to content

Game.Prefabs.EnclosedAreaData

Assembly: Assembly-CSharp (typical Unity game assembly; actual assembly may vary)
Namespace: Game.Prefabs

Type: struct

Base: Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter

Summary:
EnclosedAreaData is a lightweight ECS component used to describe an enclosed area prefab in the game's entity systems. It stores a reference to a lane/border prefab (as an Entity) that should be used for the area's border and a boolean indicating the winding/orientation (counter-clockwise) used when creating or traversing the border. This struct is intended to be attached to an entity that represents a closed area so systems can spawn or process the border lanes accordingly.


Fields

  • public Unity.Entities.Entity m_BorderLanePrefab
    Holds an Entity reference to a lane/border prefab. When converting GameObjects to entities (or when creating the entity at runtime), this should be set to the prefab entity that will be instantiated / used as the border piece.

  • public bool m_CounterClockWise
    Boolean flag indicating whether the border should be considered counter-clockwise. Systems that generate geometry, place segments, or iterate the border vertices can use this to determine orientation and vertex ordering.

Properties

  • This type defines no properties. It is a plain data struct with public fields.

Constructors

  • public EnclosedAreaData()
    As a value type (struct) it has the default parameterless constructor. Initialize via an object initializer to set fields, e.g. new EnclosedAreaData { m_BorderLanePrefab = prefabEntity, m_CounterClockWise = true }.

Methods

  • This type declares no methods. It implements marker/EP interfaces IComponentData (for ECS storage) and IQueryTypeParameter (for query-time usage), but exposes no behaviour itself.

Usage Example

// Example: adding EnclosedAreaData to an entity during conversion or runtime.
// Assume `entityManager` is a Unity.Entities.EntityManager and
// `borderLanePrefabEntity` is an Entity representing the prefab.

var enclosed = new EnclosedAreaData
{
    m_BorderLanePrefab = borderLanePrefabEntity,
    m_CounterClockWise = true
};

entityManager.AddComponentData(enclosedAreaEntity, enclosed);

// Example (authoring conversion):
public class EnclosedAreaAuthoring : MonoBehaviour, IConvertGameObjectToEntity
{
    public GameObject borderLanePrefab;
    public bool counterClockWise;

    public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    {
        var prefabEntity = conversionSystem.GetPrimaryEntity(borderLanePrefab);
        dstManager.AddComponentData(entity, new EnclosedAreaData
        {
            m_BorderLanePrefab = prefabEntity,
            m_CounterClockWise = counterClockWise
        });
    }
}

Notes: - m_BorderLanePrefab should reference a prefab Entity (converted or created) — ensure that the source GameObject is converted to an Entity prefab before assigning. - m_CounterClockWise affects orientation-dependent logic (mesh winding, placement order, etc.). Ensure systems that consume this field interpret it consistently.