Skip to content

Game.Tutorials.ForceAdvisor

Assembly: Game (assembly name as used in the project)
Namespace: Game.Tutorials

Type: struct

Base: IComponentData, IQueryTypeParameter

Summary:
ForceAdvisor is an empty/tag component defined as a blittable struct with an explicit layout size of 1. It implements Unity.Entities.IComponentData so it can be attached to entities in DOTS/ECS and IQueryTypeParameter so it can be used in query modifiers. Because the struct is empty it is given a non-zero size via StructLayout(Size = 1) to ensure it is a valid component type for the ECS runtime. This kind of type is typically used as a marker/tag to indicate that an entity should be treated specially by systems (for example, to mark entities that should trigger or bypass a tutorial advisor).


Fields

  • (none)
    This struct has no instance fields. The StructLayout attribute with Size = 1 is used to give the empty struct a non-zero size for runtime compatibility.

Properties

  • (none)

Constructors

  • public ForceAdvisor()
    No explicit constructor is defined. The default parameterless struct constructor is used (value-type default).

Methods

  • (none)
    This type contains no methods; it is intended purely as a marker/tag component.

Usage Example

// Add the tag to an existing entity using an EntityManager:
entityManager.AddComponentData(entity, new ForceAdvisor());

// Create an archetype that includes the tag:
var archetype = entityManager.CreateArchetype(typeof(ForceAdvisor), typeof(Translation), typeof(Rotation));
var newEntity = entityManager.CreateEntity(archetype);

// Query for entities that have the tag in a SystemBase:
Entities
    .WithAll<ForceAdvisor>()
    .ForEach((Entity e, ref Translation t) =>
    {
        // Do work for entities marked with ForceAdvisor
    }).Schedule();

{{ Additional info: This is a minimal, zero-data marker component. Ensure you only use it for tagging purposes — if you need to store data, add fields to the struct or use a different component type. }}