Skip to content

Game.Achievements.TransportedResource

Assembly: Assembly-CSharp
Namespace: Game.Achievements

Type: struct

Base: System.ValueType

Summary: A lightweight data container used to record that a particular cargo transport entity has moved a quantity of resource. Intended for use in the game's achievement/analytics systems (ECS context). It stores a reference to the transport Entity and an integer amount representing how much resource was transported.


Fields

  • public Unity.Entities.Entity m_CargoTransport A reference to the cargo transport Entity (for example, the vehicle, ship or transport unit that carried the resource). This can be used to identify the transport responsible for the movement.

  • public int m_Amount The quantity of resource transported. The unit (items, tons, etc.) depends on how the achievement/tracking system interprets the value. Stored as a plain integer.

Properties

  • None
    This struct exposes raw public fields and does not define any properties.

Constructors

  • public TransportedResource()
    As a C# value type, it has the implicit default constructor which initializes m_CargoTransport to Entity.Null and m_Amount to 0. No explicit constructors are declared in the source.

Methods

  • None
    There are no methods defined on this struct; it is intended purely as a data container.

Usage Example

using Unity.Entities;
using Game.Achievements;

public class AchievementExample
{
    public void RecordTransport(EntityManager entityManager, Entity targetEntity, Entity cargoEntity, int amount)
    {
        // Create the data instance
        var transported = new TransportedResource
        {
            m_CargoTransport = cargoEntity,
            m_Amount = amount
        };

        // Example: attach as component data to an entity used by the achievements system
        // (Requires that the achievements system expects this struct as a component)
        if (!entityManager.HasComponent<TransportedResource>(targetEntity))
        {
            entityManager.AddComponentData(targetEntity, transported);
        }
        else
        {
            entityManager.SetComponentData(targetEntity, transported);
        }
    }
}

Notes: - The struct does not implement IComponentData in the provided source; if you intend to use it as a Unity ECS component, ensure the appropriate interface (IComponentData or ISharedComponentData) is added as required by your ECS version and the game's conventions. - Unity.Entities.Entity is an ECS entity identifier—treat comparisons and Entity.Null appropriately when checking validity.