Skip to content

Game.ObjectAchievementData

Assembly: Game
Namespace: Game.Prefabs

Type: struct

Base: Unity.Entities.IBufferElementData

Summary:
Represents an entry for achievements associated with a prefab/object. This struct is intended to be used as a dynamic buffer element (Unity.Entities.DynamicBuffer) on entities or prefab prototypes to declare achievements that the object can trigger or contribute to. The struct contains an AchievementId reference and two boolean flags that alter how the achievement counter behaves (bypass or absolute counting).


Fields

  • public AchievementId m_ID
    Identifier of the achievement. This links the buffer element to a specific achievement defined in the achievement system (type defined in Colossal.PSI.Common). Use this to identify which achievement the entry refers to.

  • public bool m_BypassCounter
    If true, the achievement entry bypasses any normal counting/increment behavior. Typically used when the achievement should be considered satisfied or handled specially without contributing to standard counters.

  • public bool m_AbsoluteCounter
    If true, the entry indicates the achievement should be treated as an absolute counter (e.g., setting a value directly) rather than a relative/incremental counter. Behavior depends on the achievement system implementation.

Properties

  • (none)

Constructors

  • (none declared — uses default value-type constructor)
    All fields are public and default-initialized by C#. You can initialize individual fields via object initializer syntax when adding elements to a buffer.

Methods

  • (none)

Usage Example

// Example: add an achievement entry to an entity's buffer inside a system or authoring conversion.
// Assumes `ecb` is an EntityCommandBuffer and `entity` is the target entity.

var buffer = ecb.AddBuffer<ObjectAchievementData>(entity);
buffer.Add(new ObjectAchievementData {
    m_ID = /* assign an AchievementId instance referencing the achievement */,
    m_BypassCounter = false,
    m_AbsoluteCounter = false
});

// Example: reading a buffer in a Job/System
// var dynamicBuffer = EntityManager.GetBuffer<ObjectAchievementData>(entity);
// foreach (var ach in dynamicBuffer) {
//     // ach.m_ID, ach.m_BypassCounter, ach.m_AbsoluteCounter
// }

Notes: - This is a pure data container for ECS; game logic that interprets these fields is implemented elsewhere (achievement processing systems). - Ensure the AchievementId value you assign matches the achievement registration/lookup mechanism of the Colossal.PSI.Common achievement system.