Game.Tools.Override
Assembly: Assembly-CSharp
Namespace: Game.Tools
Type: struct
Base: IComponentData, IQueryTypeParameter
Summary:
A lightweight marker component (empty component) used to tag entities as belonging to or being affected by an "override" tool/behavior in the game's ECS. The struct is attributed with [StructLayout(LayoutKind.Sequential, Size = 1)] to guarantee a non-zero size (1 byte), ensuring predictable memory/layout characteristics when used by Unity.Entities and any interop code. As an IComponentData it is a component type; as an IQueryTypeParameter it can be used in query-building APIs.
Fields
- None
This struct declares no instance fields; it is an empty marker component. The explicit StructLayout with Size = 1 ensures it occupies one byte.
Properties
- None
Constructors
public Override()
(implicit default)
Because this is a value type with no explicit constructors, it has the default parameterless constructor. Instances are created asnew Override()
or via APIs that add components without data.
Methods
- None
Usage Example
// Add the marker to an entity
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
entityManager.AddComponentData(someEntity, new Game.Tools.Override());
// Query all entities that have the marker in a SystemBase
public partial class OverrideSystem : SystemBase
{
protected override void OnUpdate()
{
Entities
.WithAll<Game.Tools.Override>()
.ForEach((Entity e) =>
{
// handle override-tagged entities
}).ScheduleParallel();
}
}
Additional notes: - Use this marker to opt entities into special tool behavior or to easily filter entities in systems. - The 1-byte size specified by StructLayout helps avoid zero-sized-type edge cases and makes the component visible in memory layouts and interop scenarios.