Game.AreaTypeData
Assembly: Assembly-CSharp (typical game assembly; the concrete assembly may vary by build)
Namespace: Game.Prefabs
Type: struct
Base: System.ValueType
Implements: Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter
Summary:
A marker/component-type with no managed fields used to tag entities or prefabs that represent an "area type". The type is laid out with a fixed native size of 1 byte via [StructLayout(LayoutKind.Sequential, Size = 1)] to ensure a non-zero native footprint for ECS and native interop. This struct acts as a tag component (no payload) for filtering and archetype separation in Unity's Entities (DOTS) systems.
Fields
This struct declares no fields. It is an empty/tag component; memory layout is explicitly set to 1 byte by the StructLayout attribute to avoid zero-size issues in native interop.
Properties
This type defines no properties.
Constructors
public AreaTypeData()
(implicit default)
The struct has the implicit parameterless constructor. Because the type is empty, you typically construct it usingnew AreaTypeData()
when adding it as a component, or simply use its type in CreateEntity/CreateArchetype calls.
Methods
This type defines no methods.
Usage Example
// Add the tag to a new entity
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity entity = entityManager.CreateEntity(typeof(Game.Prefabs.AreaTypeData));
// Or add the tag to an existing entity
entityManager.AddComponent<Game.Prefabs.AreaTypeData>(existingEntity);
// Query for tagged entities
EntityQuery areaTypeQuery = entityManager.CreateEntityQuery(ComponentType.ReadOnly<Game.Prefabs.AreaTypeData>());
// Use in a SystemBase query
public partial class ExampleSystem : SystemBase
{
protected override void OnUpdate()
{
Entities
.WithAll<Game.Prefabs.AreaTypeData>()
.ForEach((Entity e) =>
{
// Handle entities that are tagged as AreaType
}).Schedule();
}
}
Notes: - Because this struct implements IComponentData, it is intended for use with Unity.Entities (DOTS) workflows. - The [StructLayout(LayoutKind.Sequential, Size = 1)] attribute ensures the type has a non-zero native size which can be important for ECS memory layout and native interop.