Skip to content

Game.Tutorials.ForceTutorialCompletion

Assembly:
Game

Namespace: Game.Tutorials

Type:
struct

Base:
System.ValueType

Summary:
A small marker/tag ECS component used to indicate that a tutorial should be considered completed (or forcibly completed). The struct is empty by design and implements IComponentData so it can be attached to entities in Unity's DOTS/ECS. It is also an IQueryTypeParameter so it can be used directly in query filters. The StructLayout(Size = 1) attribute ensures the type has a non-zero size (1 byte), which can be useful to avoid special-casing of truly zero-sized types in some code paths or serialization.


Fields

  • This type declares no instance fields.
    This is a tag component (no payload). The StructLayout attribute only reserves 1 byte of memory.

Properties

  • This type declares no properties.
    Use presence/absence of the component as the signal rather than any property value.

Constructors

  • public ForceTutorialCompletion()
    Structs have an implicit parameterless constructor; no explicit constructor is defined. Creating a new instance (new ForceTutorialCompletion()) yields the tag component.

Methods

  • This type declares no methods.
    Behavior is driven by systems that read the presence of this component on entities.

Usage Example

// Add the tag to an entity to force tutorial completion:
entityManager.AddComponentData(someEntity, new ForceTutorialCompletion());

// Or in a SystemBase, handle entities that have this tag:
public partial class TutorialCompletionSystem : SystemBase
{
    protected override void OnUpdate()
    {
        // Process and then remove the tag to avoid repeating the action
        EntityCommandBuffer ecb = new EntityCommandBuffer(Unity.Collections.Allocator.Temp);
        Entities
            .WithAll<ForceTutorialCompletion>()
            .ForEach((Entity entity) =>
            {
                // Perform forced completion logic here (e.g., mark tutorial state)
                // ...

                // Remove the tag so it only runs once
                ecb.RemoveComponent<ForceTutorialCompletion>(entity);
            }).Run();

        ecb.Playback(EntityManager);
        ecb.Dispose();
    }
}

Notes: - Treat this as a marker/tag component — attaching it to an entity should trigger systems that perform the actual tutorial completion work. - The 1-byte size via StructLayout avoids zero-sized-struct edge cases and keeps the type minimal.