Game.Routes.ColorUpdated
Assembly: Assembly-CSharp.dll
Namespace: Game.Routes
Type: struct
Base: System.ValueType (implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter)
Summary:
A small component/ tag used to indicate that a route's color has been updated. It stores the Entity reference of the route that changed. This struct is a plain IComponentData so it can be added to entities as a marker payload; systems can query for it, handle the color-change-related work, and typically remove the component to make it a one-frame event. The IQueryTypeParameter implementation allows it to be used in ECS queries where appropriate.
Fields
public Unity.Entities.Entity m_Route
Holds the Entity that represents the route whose color was updated. Typically used by systems to know which route to process. Treat this as a reference/identifier, not the route data itself.
Properties
- None.
This struct exposes only the public field m_Route.
Constructors
public ColorUpdated(Unity.Entities.Entity route)
Constructs the tag with the given route entity. Use this to create a component instance ready to be added to an entity.
Methods
- None.
This type is a plain data container (no methods).
Usage Example
// Add the tag to an entity immediately
var routeEntity = /* obtain route Entity */;
entityManager.AddComponentData(eventEntity, new Game.Routes.ColorUpdated(routeEntity));
// In a system (read-and-remove pattern)
public partial class RouteColorSystem : SystemBase
{
protected override void OnUpdate()
{
var ecb = new EntityCommandBuffer(Allocator.Temp);
Entities
.WithAll<Game.Routes.ColorUpdated>()
.ForEach((Entity e, in Game.Routes.ColorUpdated tag) =>
{
// Process the color update for tag.m_Route
// ...
// Remove the marker so it's handled only once
ecb.RemoveComponent<Game.Routes.ColorUpdated>(e);
}).Run();
ecb.Playback(EntityManager);
ecb.Dispose();
}
}
Notes and best practices: - Use EntityCommandBuffer when modifying components inside jobs or when deferring structural changes. - If you want the event to persist, keep the component; otherwise remove it after processing to make it a one-frame event. - Because this is a blittable value type with a single Entity field, it's cheap to add/remove and safe for Burst/Jobs usage.