Skip to content

Game.Prefabs.UnlockRequirementData

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: struct

Base: Implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter

Summary:
UnlockRequirementData is a simple ECS component that stores progress toward a prefab unlock requirement. It is a plain value-type component intended to be attached to entities that track whether a particular unlock condition has been met. Being an IComponentData, it is blittable and can be used in Jobs and burst-compiled systems.


Fields

  • public int m_Progress
    Represents the numeric progress toward the unlock requirement. Typical usage is to increment or set this value from systems that evaluate player actions or game state. Default (implicit) value is 0. No range is enforced by the type itself — enforce any bounds in game logic.

Properties

  • This type defines no C# properties; it exposes its data via the public field m_Progress.

Constructors

  • Implicit parameterless constructor
    As a struct, UnlockRequirementData has an implicit parameterless constructor that initializes m_Progress to 0. You can also create an instance with an explicit initializer: new UnlockRequirementData { m_Progress = 5 }.

Methods

  • This type defines no instance or static methods.

Usage Example

// Using EntityManager to create an entity and add the component
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
var e = entityManager.CreateEntity();
entityManager.AddComponentData(e, new UnlockRequirementData { m_Progress = 0 });

// In a System (Entities.ForEach) incrementing progress
public partial class UnlockProgressSystem : SystemBase
{
    protected override void OnUpdate()
    {
        // Example: increment progress every frame for demonstration (use proper conditions in real use)
        Entities.ForEach((ref UnlockRequirementData req) =>
        {
            req.m_Progress++;
        }).ScheduleParallel();
    }
}