Skip to content

Game.Tutorials.ForceActivation

Assembly:
Assembly-CSharp.dll (game code / mod runtime; most game types are compiled into the Assembly-CSharp assembly)

Namespace:
Game.Tutorials

Type:
struct

Base:
Implements: IComponentData, IQueryTypeParameter

Summary:
ForceActivation is an empty/tag component used by the tutorials subsystem. It is a blittable, 1-byte-sized struct (StructLayout Sequential, Size = 1) intended to be used as a marker to indicate that a tutorial or tutorial-related entity should be forcibly activated or considered by tutorial systems. Because it implements IComponentData it can be added to entities, and implementing IQueryTypeParameter makes it convenient to use in ECS queries and query-building APIs.


Fields

  • (none)
    This type contains no instance fields. It is a tag/marker component; memory layout is explicitly set to Size = 1 to ensure a minimal, stable size.

Properties

  • (none)

Constructors

  • public ForceActivation()
    Default (implicitly defined) parameterless constructor. The struct is empty and used solely as a marker; constructing it yields the zero-sized tag value.

Methods

  • (none)
    There are no methods on this struct — it exists only as a marker type for ECS queries/systems.

Usage Example

using Unity.Entities;
using Game.Tutorials;

// Add the tag to an existing entity (immediate, EntityManager)
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
entityManager.AddComponent<ForceActivation>(someEntity);

// Or add the tag via an EntityCommandBuffer (deferred, safe for jobs)
var ecb = new EntityCommandBuffer(Allocator.Temp);
ecb.AddComponent<ForceActivation>(someEntity);
ecb.Playback(entityManager);
ecb.Dispose();

// System that reacts to entities with the tag
public partial class TutorialForceActivationSystem : SystemBase
{
    protected override void OnUpdate()
    {
        // Example: find all entities with ForceActivation and run activation logic
        Entities
            .WithAll<ForceActivation>()
            .ForEach((Entity entity) =>
            {
                // perform tutorial activation steps for this entity
                // e.g. set other components, enqueue tutorial events, etc.
            })
            .Schedule();
    }
}

Notes and modding tips: - Because ForceActivation is a tag component, adding or removing it is typically how systems detect that an entity should be processed for "forced" tutorial behavior. - Use EntityCommandBuffer when modifying entities from jobs or systems that schedule work to avoid structural-change safety issues. - The explicit StructLayout(Size = 1) makes the component compact and stable for memory layout; do not add fields to this type unless you intend to change its purpose.