Skip to content

Game.Prefabs.MilestoneData

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: struct

Base: System.ValueType, Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter

Summary:
MilestoneData is a plain ECS component that holds configuration values for a single milestone/tier used by the game's progression systems (milestone rewards, XP thresholds, map tiles unlocked, loan limit changes, etc.). It is a value-type component intended to be attached to entities (for example milestone definition Entities or prefabs) and queried from systems. Note: the field name m_XpRequried contains a typo (Requried) — keep the name as-is when reading/writing for compatibility.


Fields

  • public int m_Index
    Index or identifier of the milestone (tier number). Used to order or reference the milestone in lists.

  • public int m_Reward
    Monetary reward associated with reaching this milestone (game currency units).

  • public int m_DevTreePoints
    Number of development/tree points awarded when the milestone is achieved.

  • public int m_MapTiles
    Number of additional map tiles unlocked by this milestone.

  • public int m_LoanLimit
    Change (typically an increase) to the player's loan limit granted by the milestone (game currency units).

  • public int m_XpRequried
    XP required to reach the milestone. (Note the typo in the field name: "Requried" — treat it as the canonical name when accessing the component.)

  • public bool m_Major
    True when this milestone is considered a "major" milestone (used to indicate bigger progression steps or trigger special behaviour/notifications).

Properties

  • This type defines no C# properties. It is a plain-data struct with public fields.

Constructors

  • public MilestoneData()
    As a struct, a parameterless default constructor exists implicitly. Typical usage is via object initializer syntax (see usage examples).

Methods

  • This type defines no methods. It is used purely as a data container (IComponentData) and queried/modified by systems.

Usage Example

// Create and attach to an entity via EntityManager
var milestone = new MilestoneData {
    m_Index = 1,
    m_Reward = 5000,
    m_DevTreePoints = 2,
    m_MapTiles = 1,
    m_LoanLimit = 10000,
    m_XpRequried = 1500, // note the field name typo
    m_Major = true
};

EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity milestoneEntity = entityManager.CreateEntity(typeof(MilestoneData));
entityManager.SetComponentData(milestoneEntity, milestone);

// Read or update from a SystemBase
Entities
    .ForEach((ref MilestoneData m) =>
    {
        if (m.m_Index == 1 && m.m_XpRequried > 0)
        {
            // modify data in-place
            m.m_Reward += 1000;
        }
    })
    .ScheduleParallel();

Notes: - Because MilestoneData implements IComponentData it should be used with the Unity.Entities API (EntityManager, SystemBase, EntityQuery). - Keep the exact field names (including the typo m_XpRequried) when interacting with existing game code or serialized data to avoid mismatches. If you control both serialization and use, you may consider mapping to a corrected field name in your tooling but preserve compatibility with game data.