Game.Prefabs.TerrainPropertiesData
Assembly:
Namespace: Game.Prefabs
Type: struct
Base: Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter
Summary:
TerrainPropertiesData is an empty (marker/tag) component type used by the ECS to identify entities that represent terrain-related properties. The struct is decorated with [StructLayout(LayoutKind.Sequential, Size = 1)] so it has a non-zero size despite carrying no fields — this is a common pattern for tag components in Unity.Entities to ensure they are handled correctly by the runtime. Because it implements IQueryTypeParameter it can be used in query expressions (e.g., WithAll
Fields
- This component defines no fields. It is an empty/tag component.
Properties
- None.
Constructors
- The struct has the default parameterless constructor provided by C#. No explicit constructors are defined.
Methods
- None.
Usage Example
using Unity.Entities;
public partial class TerrainExampleSystem : SystemBase
{
protected override void OnCreate()
{
base.OnCreate();
// Example: create an entity and add the tag component
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity archetypeEntity = entityManager.CreateEntity();
entityManager.AddComponentData(archetypeEntity, new TerrainPropertiesData());
}
protected override void OnUpdate()
{
// Query all entities that have the TerrainPropertiesData tag
Entities
.WithAll<TerrainPropertiesData>()
.ForEach((Entity e) =>
{
// Perform logic for terrain-tagged entities
})
.ScheduleParallel();
}
}