Game.Common.Updated
Assembly: Assembly-CSharp
Namespace: Game.Common
Type: struct
Base: IComponentData, IQueryTypeParameter
Summary:
Updated is an empty/tag component (IComponentData) intended to mark or flag entities that have been "updated" (or otherwise touched) so systems can filter or react to those entities. The type is decorated with [StructLayout(LayoutKind.Sequential, Size = 1)] to give it an explicit non-zero size in memory. It also implements IQueryTypeParameter so it can be used directly with Unity.Entities query APIs (e.g., WithAll
Fields
- None.
This struct contains no fields — it is intentionally an empty/tag component.
Properties
- None.
There are no properties defined on this type.
Constructors
- Implicit default constructor:
public Updated()
Because the struct has no explicit constructors, the parameterless default constructor is provided by the runtime.
Methods
- None.
There are no methods defined on this type.
Usage Example
// Add the tag to an entity
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity entity = entityManager.CreateEntity();
entityManager.AddComponent<Updated>(entity);
// Query for entities that have the Updated tag
public partial class ProcessUpdatedSystem : SystemBase
{
protected override void OnUpdate()
{
// Example: operate only on entities that have the Updated tag
Entities
.WithAll<Updated>()
.ForEach((Entity e, ref SomeComponent comp) =>
{
// process component for entities marked as Updated
comp.value += 1;
})
.Schedule();
// Optionally remove the tag after processing
// (use EntityCommandBuffer in jobified code paths)
EntityCommandBuffer ecb = new EntityCommandBuffer(Allocator.Temp);
Entities.WithAll<Updated>().ForEach((Entity e) =>
{
ecb.RemoveComponent<Updated>(e);
}).Run();
ecb.Playback(entityManager);
ecb.Dispose();
}
}
Notes: - The StructLayout(Size = 1) attribute ensures the type has a defined non-zero size; this can be useful for certain serialization/interop or container scenarios even though the struct carries no data. - Because this is a tag component, prefer query-based filtering (WithAll/Without) or AddComponent/RemoveComponent when marking entities, and use EntityCommandBuffer when modifying component sets inside jobified code.