Game.Tools.Debug
Assembly: Assembly-CSharp (typical for game/mod code; adjust to your mod assembly name if different)
Namespace: Game.Tools
Type: struct
Base: System.ValueType, Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter
Summary:
A deliberately empty marker component used with Unity's ECS. The StructLayout attribute with Size = 1 forces a 1-byte size for the struct so it is not treated as a zero-sized type by the ECS/serialization systems. Implementing IComponentData makes it a component that can be attached to entities; implementing IQueryTypeParameter allows it to be used directly in query-building APIs as a type parameter (e.g., WithAll
Fields
- (none)
This struct defines no data fields; it is a tag/marker component. The explicit size is provided via StructLayout to ensure a defined nonzero size.
Properties
- (none)
No properties are defined — the type carries no runtime data, only its presence/absence matters.
Constructors
public Debug()
The default parameterless value-type constructor applies. No custom construction logic is required.
Methods
- (none)
No methods are declared.
Usage Example
// Add the marker to an entity
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
var entity = entityManager.CreateEntity();
entityManager.AddComponentData(entity, new Game.Tools.Debug());
// Query for entities that have the marker
Entities
.WithAll<Game.Tools.Debug>()
.ForEach((Entity e) =>
{
// This executes for entities tagged with Game.Tools.Debug
})
.Run();
Additional notes: - Because this is a marker component, systems typically check for its presence (WithAll/WithNone/HasComponent) rather than reading data from it. - The StructLayout(Size = 1) trick is commonly used to avoid special-casing of zero-sized types in some ECS/serialization workflows; keep it if you rely on a stable nonzero footprint.