Game.Common.PathfindUpdated
Assembly: Assembly-CSharp (game/mod assembly where this type is compiled)
Namespace: Game.Common
Type: struct
Base: IComponentData, IQueryTypeParameter
Summary: A marker/tag component indicating that pathfinding data for an entity (or a set of entities) has been updated. The struct contains no payload and is intended to be used purely as a flag for queries or systems that need to react to pathfinding updates. The StructLayout attribute forces a sequential layout with Size = 1 to ensure the component occupies storage (i.e., is not treated as a zero-sized type) when needed.
Fields
- This struct declares no managed fields. {{ This is an empty/tag component; layout is forced to 1 byte via the StructLayout attribute to ensure it occupies storage rather than being a zero-sized component. }}
Properties
- This struct exposes no properties. {{ Use it as a pure marker/tag component — there is no data to read or write. }}
Constructors
public PathfindUpdated()
(implicit/default) {{ The type relies on the implicit parameterless constructor of a struct. Instantiating withnew PathfindUpdated()
produces the tag instance. }}
Methods
- This struct declares no methods. {{ It implements IComponentData and IQueryTypeParameter only to serve as a component and as a query type parameter for ECS queries. }}
Usage Example
// Add the tag to an entity (EntityManager API)
entityManager.AddComponentData(entity, new PathfindUpdated());
// Check for the tag
bool updated = entityManager.HasComponent<PathfindUpdated>(entity);
// Remove the tag
entityManager.RemoveComponent<PathfindUpdated>(entity);
// Example in a SystemBase: process and clear the tag
public partial class PathfindUpdateSystem : SystemBase
{
protected override void OnUpdate()
{
// Process all entities that have the PathfindUpdated tag
Entities
.WithAll<PathfindUpdated>()
.ForEach((Entity e, in SomeOtherComponent comp) =>
{
// React to pathfinding update...
})
.Schedule();
// Optionally remove the tag after processing (example uses EntityCommandBuffer)
var ecb = new EntityCommandBuffer(Unity.Collections.Allocator.Temp);
Entities.WithAll<PathfindUpdated>().ForEach((Entity e) =>
{
ecb.RemoveComponent<PathfindUpdated>(e);
}).Run();
ecb.Playback(EntityManager);
ecb.Dispose();
}
}
{{ Notes: - Treat PathfindUpdated as a tag component for signaling systems. - The StructLayout(Size = 1) attribute ensures the struct has a non-zero storage footprint; this can be important depending on how you want the component to behave in terms of memory/archetype layout and queries. - Because the type implements IQueryTypeParameter it can be used as part of query definitions or filters in ECS query-building APIs. }}